[ros-dev] VOTE: List loop macros in ntoskrnl?

Gunnar Dalsnes hardon at online.no
Thu Sep 29 14:10:20 CEST 2005

Magnus Olsen wrote:
> I vote no
> for it make the code harder to read and undertsand a bad example why not use
> maroc inntoskrnl see
> file win32k/eng/gardine.c  go to middle of the file. and try figout what the
> hell going on there.

But this is about the list macros. Are they a bad example of macro usage 

But what do you suggest as an improvement to the file you pointed out? 
Would you understand it if the macros were inlined functions? I hope 
your dont mean that the code should be repeated instead of putting the 
code in a function.

> that is one exmple why not use marco. I are ageinst marco when it been using
> to hide
> complex code that are bit ugly when it using goto.  I am using goto some
> time in my code
> as last resures. And hide complex code that contain goto is even worse
> in my eys and try understand what the hell is going on alot harders to
> figout when u are using marco
> with complex code.

The list macros doesnt use goto. The list macros hide a for() loop (as 
you can tell by the "for" in its name: LIST_FOR_EACH).

There are good/bad examples of any code, macros or not. Just because 
macros can (easily?) be abused and have been abused doesnt mean we 
should never use them. To me it seems like macros is used as a 
punchingball when someone stumble upon code that is hard to understand. 
I probably dont understand more than 5% of the code in Reactos, but i 
dont blame macros for it. Used with care, macros are powerfull tools.


More information about the Ros-dev mailing list