[PATCH] Updated Legacy code in arm csb336

Vipul Nayyar nayyar_vipul at yahoo.com
Tue Jul 9 12:21:04 UTC 2013


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  ?

Vipul Nayyar 

 From: Peter Dufault <dufault at hda.com>
To: Vipul Nayyar <nayyar_vipul at yahoo.com> 
Cc: "rtems-devel at rtems.org" <rtems-devel at rtems.org> 
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 <nayyar_vipul at yahoo.com> 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 Dufault
HD Associates, Inc.      Software and System Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130709/56268561/attachment.html>

More information about the devel mailing list