Chris Johns and I chatted about a similar situation with the use of some of the bspopts.h constants. Some are 0/1 and always defined which makes checking if it is defined bogus.
Personally I would move to the simple #if and define it to be 1. That way when 0 or defined, the code is correct. Vipul Nayyar <[email protected]> wrote: Hello, Seems like a valid point to me, that you got there. Sebastian, What do you suggest ? Simply remove the 1 from '#define USE_INTERRUPTS 1' or change #if defined() to simply #if ? Regards Vipul Nayyar ________________________________ From: Peter Dufault <[email protected]> To: Vipul Nayyar <[email protected]> Cc: "[email protected]" <[email protected]> Sent: Tuesday, 9 July 2013 5:22 PM Subject: Re: [PATCH] Updated Legacy code in arm csb336 On Jul 8, 2013, at 09:43 , Vipul Nayyar <[email protected]<mailto:[email protected]>> wrote: > /* Define this to use interrupt driver UART driver */ > #define USE_INTERRUPTS 1 ( . . . ) > #if defined(USE_INTERRUPTS) Personal observation: I don't like using "#define USE_INTERRUPTS 1" in conjunction with "#if defined(USE_INTERRUPTS)". Someone not too careful will change it to "#define USE_INTERRUPTS 0" and not understand why it is still being used. I either use "#define USE_INTERRUPTS" (I know it is defined to be 1) or "#define USE_INTERRUPTS 1" (or 0) in conjunction with "#if USE_INTERRUPTS". I use the second idiom in my own code, it also protects against typos such as "#if defined(USE_INTERUPTS)" Peter ----------------- Peter Dufault HD Associates, Inc. Software and System Engineering
_______________________________________________ rtems-devel mailing list [email protected] http://www.rtems.org/mailman/listinfo/rtems-devel
