On Sat, May 2, 2009 at 12:26 PM, Michael Schwingen <rincew...@discworld.dascon.de> wrote: > Zach Welch wrote: >> With autotools, #ifdef should be preferred. For example, HAVE_FOO_H >> will be defined 1 by the AC_CHECK_HEADERS([foo.h],[1],[Comment]) macro; >> configure defines the symbol to the given value if foo.h is present, and >> the symbol is not defined if absent. In both cases, the definition will >> exist in config.h, but it will be commented out when not defined; the >> same would be true for the OpenOCD symbols, except that they are defined >> explicitly. >> > I don't know about autotools, but I do prefer #if, because that way, you > get warnings if the correct headers are not included. When using #ifdef, > a missing header may lead to wrong code without a warning. > > cu > Michael >
I prefer #if because it is a clearer syntax: #if IS_WIN32 #if ! IS_WIN32 #if IS_WIN32 || IS_UNIX vs. #ifdef IS_WIN32 #ifndef IS_WIN32 #if defined(IS_WIN32) || defined(IS_UNIX) The ! syntax is more expressive than the 'n' buried somewhere in between. The boolean operations are more focussed on what is going on and they are easier to extend (thus less error prone). Michael _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development