Amanda-Users

Re: NO_AMANDA (was Re: RAIT in 2.4.3b4)

2003-01-30 19:15:09
Subject: Re: NO_AMANDA (was Re: RAIT in 2.4.3b4)
From: "Marc W. Mengel" <mengel AT fnal DOT gov>
To: Scott Mcdermott <smcdermott AT questra DOT com>
Date: Thu, 30 Jan 2003 17:44:42 -0600 (CST)
> one more thing I'm curious about: is the backwards C idiom
>
>    if (0 != sometestfunc())
>
> instead of the usual
>
>    if (sometestfunc() != 0)
>
> preferred by amanda developers, or Mr. Mengel? It's very strange to
> read, I've never seen it before :)

Well, I can't speak for the other developers but putting the constant on
the left is just good C coding practice. It avoids == vs = typographical
errors.  Put simply:
   if ( 0 = x )
is a syntax error while
   if ( x = 0 )
is not; so if you accidentally type = instead of != or ==, you
get an error message, instead of unintentionally making an
assignment.


<Prev in Thread] Current Thread [Next in Thread>