[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: Newbie question

From: Bob Paddock
Subject: Re: [avr-gcc-list] Re: Newbie question
Date: Thu, 26 Feb 2009 08:29:20 -0500

>> Also enable compiler warnings - at a minimum, use these flags:
>>        -Wall -Wextra -Wunreachable-code
>> Then the compiler would have told you of your error here.

I always run with the warnings maxed out, due to a "No Warning" policy.
However I did have to turn unreachable-code off.  It gave far to many
false positives.  Anyone have any ideas why?

I did not see 'pedantic' mentioned in the other warnings mentioned
in this thread:

# -pedantic : Issue all the mandatory diagnostics listed in the C
# standard. Some of them are left out by default, since they trigger frequently
# on harmless code.
# -pedantic-errors : Issue all the mandatory diagnostics, and make all
# mandatory diagnostics into errors. This includes mandatory diagnostics that
# GCC issues without -pedantic but treats as warnings.
#CFLAGS +=  -pedantic

> Sigh..  This is my second program in C.. On the first one, I got beat up for
> NOT doing the brackets the way I am now..

The debating of where to place the braces can be a great waste of time.
Pick a style and be consistent.  What is never open for debate is  that
braces must be used at all times.  Standards like MISRA
http://www.misra.org.uk/ always require braces in all cases.
Not using braces open you up to problems like "dangling elses".

Setup a 'coding standard' policy and stick to it.

http://www.ganssle.com/misc/fsm.doc is a good starting point.

http://www.ganssle.com/inspections.pdf is also good for some one
new to read.

>I got beat up for NOT doing the brackets the way I am now..


reply via email to

[Prev in Thread] Current Thread [Next in Thread]