<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<pre style="word-wrap:break-word; font-size:10.0pt; font-family:Tahoma; color:black">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 <nayyar_vipul@yahoo.com> wrote:
</pre>
<div>
<div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt">
<div><span>Hello,</span></div>
<div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;">
<span><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;">
<span>Seems like a valid point to me, that you got there. </span></div>
<div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;">
<span><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;">
<span>Sebastian, What do you suggest ? Simply remove the 1 from '</span><span style="font-family: 'times new roman',
'new york', times, serif; font-size: 16px;">#define USE_INTERRUPTS 1' or change #if defined() to simply #if ?</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">
<span style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px;"><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, clean, sans-serif; background-color: transparent; font-style: normal;">
Regards</div>
<div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, clean, sans-serif; background-color: transparent; font-style: normal;">
<span style="background-color:transparent;line-height:1.22;">Vipul Nayyar </span></div>
<div style="color: rgb(0, 0, 0); font-size: 12.727272033691406px; font-family: arial, helvetica, clean, sans-serif; background-color: transparent; font-style:
normal;">
<br>
</div>
<div><br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;">
<div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">
<div dir="ltr">
<hr size="1">
<font size="2" face="Arial"><b><span style="font-weight:bold;">From:</span></b> Peter Dufault <dufault@hda.com><br>
<b><span style="font-weight: bold;">To:</span></b> Vipul Nayyar <nayyar_vipul@yahoo.com>
<br>
<b><span style="font-weight: bold;">Cc:</span></b> "rtems-devel@rtems.org" <rtems-devel@rtems.org>
<br>
<b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 9 July 2013 5:22 PM<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [PATCH] Updated Legacy code in arm csb336<br>
</font></div>
<div class="y_msg_container"><br>
<br>
On Jul 8, 2013, at 09:43 , Vipul Nayyar <<a ymailto="mailto:nayyar_vipul@yahoo.com" href="mailto:nayyar_vipul@yahoo.com">nayyar_vipul@yahoo.com</a>> wrote:<br>
<br>
> /* Define this to use interrupt driver UART driver */<br>
> #define USE_INTERRUPTS 1<br>
<br>
( . . . )<br>
<br>
> #if defined(USE_INTERRUPTS)<br>
<br>
Personal observation:<br>
<br>
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.<br>
<br>
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)"<br>
<br>
Peter<br>
-----------------<br>
Peter Dufault<br>
HD Associates, Inc. Software and System Engineering<br>
<br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>