in reply to Re: Re: variable set to 0 ? 0 : 1
in thread variable set to 0 ? 0 : 1
The point of formatting one's code is to make the meaning clear to the reader. This reader finds:
I *think* I know what the second line does, but I'm not 100% sure. Blame my 15 years of programming in C, but I have to use brackets when I write a return statement. If that means I'm writing C in Perl, so be it.return ( ( $status == 0 ) ? 0 : 1 ); # Readable, clear. return $status == 0 ? 0 : 1; # Confusing. Precedence?
I also like to put brackets around a conditional, to highlight that there's a logic test going on. I know that operator precedence will take care of it without brackets, but why strain my brain.
Really, this is a tempest in a teapot. My Dad had a wonderful sentence that he claimed made sense, if only it were punctuated correctly: Smith, where Jones had had had had had had had had had had had the examiner's approval. Perfectly understandable: no punctuation is necessary, is it?
--t. alex
but my friends call me T.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: variable set to 0 ? 0 : 1
by Flexx (Pilgrim) on Sep 07, 2002 at 12:21 UTC | |
by talexb (Chancellor) on Sep 07, 2002 at 22:34 UTC | |
by blakem (Monsignor) on Sep 07, 2002 at 23:45 UTC | |
by Flexx (Pilgrim) on Sep 08, 2002 at 22:11 UTC |