Recommendation for a text

J

Jorgen Grahn

I'm mostly a C person, and I agree you have a point.
Whenever I have a nontrivial data structure, let's
call it struct bigmess, it's always accompanied by
"methods" struct bigmess *new_bigmess(), and
int delete_bigmess(), that I write myself and that
do all the ugly mallocing and freeing necessary,
hiding all that housekeeping from the rest of the
application. Lots of useful C++ ideas can be
incorporated into C design

But that's partly the thing I complain about above! If all you have is
struct bigmess *new_bigmess();
then every single struct bigmess in your program is individually
malloc()ed. Not much fun, especially if you have many small structs
and structs-within-structs rather than few big ones.

You can of course complement new_bigmess() with a
int init_bigmess(struct bigmess*);
so you can create them on the stack, in arrays or as parts of bigger
structs. This still doesn't solve the container problem though.
(but I don't want to
get into the naive argument, "then why use C?").

It's not naive (it's a good question) but it's something I try not to
bring up here. People who read c.l.c presumably want to read about C,
not about how some other language is better. (Knowing the shortcomings
of C compared to other languages is useful, though.)

/Jorgen
 
M

Marco

Greetings,
Next fall I will be running a special topics course with the title "Modern C Programming". The motivation for the course is that currently our CS students are exposed to C++, Java and a smattering of other languages (e.g. Lisp in an elective AI course) but no C per se. While in principle they learn some C naturally in the course of learning C++ they really don't learn all that much about things like pointers, malloc, and the safe handling of C-style strings and they definitely don't learn anything about C99. The proposed class is intended to give a serious introduction to C to students who have a working knowledge of either C++ or Java. This will allow me to blow through the basic syntax of expressions, loops, etc. in a couple of weeks and to spend the bulk of the semester on aspects of C which are different from Java and even C++.


Since your students have some programming "experience" already I strongly recommend:
Test Driven Development for Embedded C by Grenning
<http://www.amazon.com/Driven-Development-Embedded-Pragmatic-Programmers/dp/193435662X>

C is definitely used in the embedded field and for low level programming such operating systems.

It covers TDD and many advanced C techniques. It is very "modern".

It is inexpensive.

Buy it for yourself at least.
 
F

Francois Grieu

Since your students have some programming "experience" already I strongly recommend:
Test Driven Development for Embedded C by Grenning
<http://www.amazon.com/Driven-Development-Embedded-Pragmatic-Programmers/dp/193435662X>

C is definitely used in the embedded field and for low level programming such operating systems.

It covers TDD and many advanced C techniques. It is very "modern".

It is inexpensive.

Buy it for yourself at least.

This book is NOT about C, and not even much about embedded systems.
It uses C in embedded systems as an illustration of Test Driven
Development, wich is the subject.

As such, it does not seem recommandable for the purpose of the OP.

Francois Grieu
 
M

Marco

This book is NOT about C, and not even much about embedded systems.
It uses C in embedded systems as an illustration of Test Driven
Development, wich is the subject.

As such, it does not seem recommandable for the purpose of the OP.

Francois Grieu




This book is NOT about C, and not even much about embedded systems.
Have you read it? Very much about C features especially in the embedded space.
It uses C in embedded systems as an illustration of Test Driven
Development, wich is the subject.

TDD should be taught to students IMHO.
As such, it does not seem recommandable for the purpose of the OP.

Since the OP said the students already had some programming experience then they could learn the basic C syntax and semantics from a free online book, the instructor could then concentrate on teaching pointers and structs (which the students didn't see in their Java class).

example free book:
<http://en.wikibooks.org/wiki/C_Programming>

OK maybe just the instructor should purchase Grenning book and read it and then introduce a few TDD concepts. His students would probably be impressed..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top