On Mon, Jun 16, 2008 at 10:02 AM, Derek Gaston <[EMAIL PROTECTED]> wrote:
> OTOH these things are warnings for a reason... they _do_ degrade the
> readability of your code.  I would vote for leaving the warnings there and
> letting (as Ben put it) "attrition" take care of them.

This is definitely subjective.  I believe the if-else structure quoted
earlier is actually *more* readable without the extra curly braces --
I don't have to go looking for the matching brace or even use a text
editor command to match them when they don't exist in the first place.

On the other hand I find, Roy's complex logic statements hard to
understand because I'm surely not the coder he is :)  but I don't
think the compiler should warn about this code either (assuming it's
correct!)  I'm sure he put considerable effort into obfuscating it; we
don't need the compiler nanny to come along and confirm that fact ;-)

-J




> Derek
>
> On Jun 16, 2008, at 8:49 AM, John Peterson wrote:
>
>> On Mon, Jun 16, 2008 at 9:23 AM, Benjamin Kirk <[EMAIL PROTECTED]>
>> wrote:
>>>>
>>>> Is the lack of extra curly braces now a warning, and therefore we
>>>> should code accordingly?
>>>
>>> Yeah, in gcc-4.3 it warns that it is ambiguous when 'if' the 'else'
>>> corresponds to.  My personal feeling is that for compound clauses which
>>> fit
>>> on one screen height it is pretty clear provided you have decent
>>> indenting,
>>> but it is an easy enough change.
>>>
>>> I'm not in a hurry to fix the few remaining places where it warns -- I
>>> assume they'll get fixed by attrition when gcc-4.3 becomes the base of
>>> newer
>>> linux installations.
>>>
>>> Also, much to Roy's chagrin I'm sure, it warns about uber-complex clauses
>>> when you've got compounded && || etc... and are relying on the evaluation
>>> rules for correctness.  I've always leaned a little far to the
>>> superfluous
>>> ()-side because I'm nervous I'll screw one up.
>>
>>
>> Hmm,
>>
>>> From here: http://gcc.gnu.org/gcc-4.3/changes.html#4.3.1
>>
>> | The -Wparentheses option now works for C++ as it does for C. It
>> warns if parentheses are
>> | omitted when operators with confusing precedence are nested. It also
>> warns about ambiguous
>> | else statements. Since -Wparentheses is enabled by -Wall, this may
>> cause additional warnings
>> | with existing C++ code which uses -Wall. These new warnings may be
>> disabled by using -Wall
>> | -Wno-parentheses.
>>
>> So... I guess we could also just turn it off if desired.  It seems a
>> little over-zealous to me, but since I'm not at 4.3 yet I don't think
>> I'll change any configure scripts or anything.
>>
>> -J
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Libmesh-devel mailing list
>> Libmesh-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/libmesh-devel
>
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to