[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Stats and code readability
From: |
Zschocke, Florian |
Subject: |
Re: [lwip-users] Stats and code readability |
Date: |
Wed, 18 Jun 2003 15:44:08 +0200 |
Ed Sutter wrote on Mittwoch, 18. Juni 2003 15:16:
> #define MACRO_XYX(var) do{++var;}while(0)
>
> My question is...
> Why do that instead of just doing...
>
> #define MACRO_XYZ(var) ++var
In this case you're probably right. It's important with multi-expression
macros, and I just do it with single expression macros out of a habit. A
good compiler optimizes the loop away. I don't know if a case could be
constructed where the single-expression macro could cause trouble. The
general problem and where this do{}whlie(0) construct comes from is
explained here:
http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing%2
0the%20Semicolon
Florian.
- [lwip-users] Stats and code readability, Zschocke, Florian, 2003/06/18
- Re: [lwip-users] Stats and code readability, Ed Sutter, 2003/06/18
- Re: [lwip-users] Stats and code readability, Kieran Mansley, 2003/06/18
- Re: [lwip-users] Stats and code readability, Marc Boucher, 2003/06/18
- Re: [lwip-users] Stats and code readability, Leon Woestenberg, 2003/06/18
- Re: [lwip-users] Stats and code readability, Marc Boucher, 2003/06/18
- Re: [lwip-users] Stats and code readability, Leon Woestenberg, 2003/06/18
- Re: [lwip-users] Stats and code readability, Marc Boucher, 2003/06/19
- Re: [lwip-users] Stats and code readability,
Zschocke, Florian <=