C help please - C newbie

I should have said "regular C" or something like that, meaning ordinary, everyday, hosted C.

I've never though of H&S as a tutorial, and I would be concerned that the discussions of differences between various versions would be at best noise and at worst confusing to a beginner.

I disagree here, especially if that someone expects to work on more than one platform in his career. You can't write Z80 code forever ;-)

This is a good place to quote a bit of an excellent article recently written to comp.lang.c by Steve Summit:

--
Al Balmer
Balmer Consulting
 Click to see the full signature
Reply to
Alan Balmer
Loading thread data ...

Some of the worst software around is written in C. Some of the best software around is written in C.

It ain't the language.

--
Al Balmer
Balmer Consulting
 Click to see the full signature
Reply to
Alan Balmer

Why don't you tell us all exactly which features of C90-C99 are misrepresented or left out of K&R2? I'm especially interested in learning what things that would be of interest to the typical embedded systems programmer are left out of K&R2. Please enlighten me.

Reply to
Sheldon Simms

The Harbison & Steele book is an excellent reference, but a poor tutorial and definitely not the right book to learn C with.

Reply to
Sheldon Simms

For example?

And how would other C tutorial books would avoid this problem? They seem to pretty much universally assume a console.

Any why did you have such an incompetent newbie working on the project anyway? Do they take people fresh out of their first C programming course and throw them on small embedded systems where you work? Sounds like you guys must do really high quality stuff...

Reply to
Sheldon Simms

I still tend to use "C Primer Plus" as my basic reference for most things, I used it to learn C 15 or 20 years ago and still find it answers most of my questions, I don't know which edition I have though as my son has pinched it - Grrrrrhhhh :)

I would recommend it to beginners.

Mike Harding

Reply to
Mike Harding

... snip ...

Whenever a spare pin is available for a serial output. If there is a built in display better yet.

--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
 Click to see the full signature
Reply to
CBFalconer

In article , Alan Balmer writes

No but you appear to be saying that you do... You do not. What is more I know many who would disagree with you about K&R for novices. You can not presume to speak for a NG anymore than I can. though I have spoken for the UK on C matters. Our normal UK experts to WG14 also does not recommend K&R for novices.

As they say empty vessels make most noise... I usually post on comp.std.c and the ISO WG14 mail list.

So will I.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ snipped-for-privacy@phaedsys.org

formatting link
\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Reply to
Chris Hills

In article , Sheldon Simms writes

Not books on C for embedded use.

He was the project manager. His programming dated back to when K&R was the standard.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ snipped-for-privacy@phaedsys.org

formatting link
\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Reply to
Chris Hills

In article , Alan Balmer writes

This is comp.arch.embeded. you mean every day regular machine specific self-hosted C

Likewise K&R

Yes.. go for the latest version. If you find the differences between versions confusing K&R will not help.

No.... but it is a good place to start. there is little point in learning a version of C that is not for your target... BTW AFAIK no-one inthe embedded world (or MS) uses "standard-C"

But what you are suggesting is WORSE. I said use a book that gives C for your platform as that will be closer to the current standard.

You are saying use a version of Standard C that is obsolete and has not been standard for 15->30 years, for which there are no current compilers.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\ /\/\/ snipped-for-privacy@phaedsys.org

formatting link
\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Reply to
Chris Hills

If you are aiming for small micros (8-bitters) rather than big ones (32-bit), then your best bet for learning to write good programs is to learn assembly first, and only when you have a lot of understanding and experiance on the micro should you look at C. That way you write C code that generates assembly suitable for small micros, rather than something suitable for bigger computers.

Reply to
David Brown

I'll hold my hand up for the new Forth, not the old FORTH. Optimised ANS Forths. As fast as C, wth a wonderful test and debug environment.

Honest, I did think before responding.

Stephen

-- Stephen Pelc, snipped-for-privacy@INVALID.mpeltd.demon.co.uk MicroProcessor Engineering Ltd - More Real, Less Time

133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web:
formatting link
- free VFX Forth downloads
Reply to
Stephen Pelc

Pardon the French, Chris, but that's nonsense and you know it. It's irresponsible to artificially limit your consideration of K&R to the first edition (the other is not 25 years, but 15 years old), which has not been printed or sold for 15 years now.

These days, K&R for all means and purposes _is_ K&R2, not the ancient, completely out-of-print first edition. And K&R2 is only one full standard and a couple of relatively minor amendments behind, not "many standards behind".

Since I've yet to see any widely used C compiler, embedded or not, claim actual C99 compliance, let alone that being the case for the majority of them, and the amendments to C90 are not particularly relevant to embedded computing, I honestly fail to see what your quarrel with K&R2 might be. It teaches C, the _language_, and it does it well.

As a textbook to learn the language from? You must be kidding.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Chris Hills wrote in news:TdlmkHBu5ou $ snipped-for-privacy@phaedsys.demon.co.uk:

You sure you looked at the second edition there?

--
Richard
Reply to
Richard

As previously said, I do recommend assembly language first. However, I recommend it regardless of whether the engineer will be working on

8-bit cpus, 64-bit cpus, or IBM mainframes.

--
Al Balmer
Balmer Consulting
 Click to see the full signature
Reply to
Alan Balmer

Not to quibble, but my recollection has a copy of K&R in my hands before 1985, probably 1982-3, and I don't think it was new then. K&R were doing their stuff on PDP-11s that I saw running up in Maynard, MA, in '73-4, but I was doing OEM support of 12-bit machines and have no idea how far along they were at that point.

Note to the OP: Seems like you've hit on a "religious" issue. Who'da thunk it?

Regards, Ken Asbury

Reply to
Ken Asbury

standards

no kidding.

-bryan

Reply to
Bryan Bullard

Of course not. That would have been K&R1, then: the now thoroughly outdated first edition of the book which came out in 1978, and is thus

25 years old by now.

The "other" one I was referring to is K&R2, the second edition covering ANSI C, which hit the shelves in 1988. That's slightly earlier than the ANSI C Standard was actually issued (1989), but the book still matches the standard (and also C90, it's ISO re-issue).

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

But _which_ embedded systems? There are tons of embedded systems work that use 32-bit CPUs with console access trivially available, and plenty with 8-bit CPUs.

--
Darin Johnson
    Laziness is the father of invention
Reply to
Darin Johnson

But it's not 25 years out of date.

It's only 15 years out of date because that's when the new standard came out, but possibly as few as 10 years because that's when conforming compilers became the norm.

--
Darin Johnson
    Support your right to own gnus.
Reply to
Darin Johnson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.