Bits and pieces about free software and various other things.

Sunday, July 26, 2009

Reading C

Reading C declarations (with all the magic) is easy...

A (good looking) friend of mine pointed me to this nice article, after reading it I had to ask: why isn't this the first thing you learn when learning C?

enjoy:
http://www.antlr.org/wiki/display/CS652/How+To+Read+C+Declarations

(of course the "good looking" was his suggestion...)

2 comments:

hb said...

Actually, it is one of the first things you learn if you learn C by means of reading Kernighan & Richie (and really, is there any other way?)

tuXXX said...

It's not always the first thing you learn, but it's one of the things have to learn to be able to really understand C code.
(I think that this depends if C is the first programming language you learn or not, if you already knows basic algorithm then it'll be one of the first things)
Of course, the first thing you learn in C is pointers.

But for me, the examples given here are too much complicated and shouldn't stay in real code. Typedefs are the way to go.

int (*(*vtable)[])();

typedef int (*fnptr)();
fnptr (*vtable)[];

Blog Archive


View My Stats