[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Stats and code readability
From: |
Kieran Mansley |
Subject: |
Re: [lwip-users] Stats and code readability |
Date: |
Wed, 18 Jun 2003 14:31:20 +0100 (BST) |
On Wed, 18 Jun 2003, Ed Sutter wrote:
> Florian,
> I did something similar to the XXX_STATS macros on one of
> the earlier versions of LWIP. Makes the code a lot more
> readable. Having updated to the latest, I lost those
> changes (should have submitted the suggestion a while ago).
> So I second this request.
Seems like a popular request! No objections from me. Does anyone
volunteer to make the changes, bearing in mind there are quite a lot of
them and they'll need to be done by hand?
> However, I have a question that is most likely going to
> further reveal my own stupidity...
> I see in several places in the LWIP code the following...
>
> #define MACRO_XYX(var) do{++var;}while(0)
>
> My question is...
> Why do that instead of just doing...
>
> #define MACRO_XYZ(var) ++var
>
> Is this just a "style" thing, or is there value in
> using the upper format instead of the visually simpler
> lower format?
Good question. I'm not sure. When I last thought about it I figured it
was just putting the macro into it's own scope, but then thought that this
could just as easily be achieved with curly braces and no do/while().
Perhaps some compilers don't deal with curly braces on their own very
well, and so this is a universal work around? In essence, I don't know
the real answer!
Kieran
- [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 <=
- 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