[ros-dev] Re: [ros-svn] [gdalsnes] 18113: -reorder InsertXscendingOrder macro argument order and update uses

Joseph Galbraith galb at vandyke.com
Wed Sep 28 01:08:48 CEST 2005

Gunnar Dalsnes wrote:
> Phillip Susi wrote:
>> Recently I was reading over some apache code and they make extensive 
>> use of macros for flow control.  I found myself becoming frustrated to 
>> no end because I could not figure out what the hell was going on.  
>> They looked like nice, neat function calls, but I could not for the 
>> life of me figure out where the code was that was being called.
> So if they had been function calls and not macros it would have been 
> easier??? Or should we stop using functions also? ;-P

Well, yes...

You can't step into macros in most debuggers (that I use.)

As Alex mentioned, it is a pain to try and sprinkle
debugging statements in a macro (if only because the
syntax is so ugly.)

Macros have ill defined side effects.  This is especially
damaging to code maintainability when macros look like

Macros are bug prone because they have additional unique
issues over normal code, they are hard to read, and hard
to debug.

C++ (and some latter version of C if I'm not mistaken)
added inline functions for a reason: so programmers would
stop using macros.

> If you cant find a macro (simple text search) you probably wouldnt have 
> understod the code _without_ the macros either;-P

If I'm searching for something that looks like a function
call (especially if I'm searching for the definition not
the declaration), I might be looking in the wrong places
or searching using syntax that doesn't catch a #define.



More information about the Ros-dev mailing list