avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Re: Passing a string variable to lcd_puts


From: David Brown
Subject: [avr-gcc-list] Re: Passing a string variable to lcd_puts
Date: Tue, 31 Mar 2009 07:52:49 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Bob Paddock wrote:
On Mon, Mar 30, 2009 at 2:48 PM, David VanHorn <address@hidden> wrote:
I thought I must be doing something fairly trivial wrong, this IS
only my second project in C...

Dave, I have two recommendations for a beginner at C.

1) Buy yourself a copy of Gimpel Lint, even if you have to pay
for it out of your own pocket, it will be money well spent in the long
run.  http://www.gimpel.com/ .  It will be the best C tutor
you could have.   When you run your first piece of code through
it you will be appalled at the number errors it finds.  Not because
you are a beginner, tho that might help, it is because in C it is
so easy to shoot yourself in the foot.   Alas there are few alternative
languages for dealing at the bare metal level.

Also you can learn a lot just by reading Gimpel's Bug of the Month:

http://www.gimpel.com/html/bugs.htm

2) Get yourself a copy of the MISRA guidelines:
http://www.misra-c2.com/
Right now someone on the list is reading that and saying
"Say what?  Recommending MISRA to a new C Programmer?".
Yes.  Even if you don't try to write your code to MISRA, the explanation
of the rules, ie. the landmines you don't want to step on will be beneficial
to your C education.


Be a little careful of some of the MISRA rules, however. Some, such as writing your conditionals as "if (1 == x)", lead to uglier code and are totally unnecessary if you have gcc warnings enabled (and certainly if you are using lint!). It takes a bit of experience to know when MISRA is bad style or bad advice, and a lot of experience to have the self-confidence to assume that *you* know better than MISRA. So as Bob says, don't try to follow MISRA - but it can be worth skimming through for ideas.

If you get truly and utterly stuck, I'm about 90 miles from you and can
come down your way some weekend if you need any help.






reply via email to

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