C: what I had forgotten

published 2014-01-02 [ home ]

Thanks to my new job I will have the opportunity to write a lot more C than in the last three years. To prepare for this, I decided to read some old C89 books again and see what I remembered. Here are some of the quirks I had forgotten (or never known about).

const struct stuff_s {
  /* stuff */
} stuff_t;

means the same thing as:

struct stuff_s {
  /* stuff */
} const stuff_t;

but if you wrote it you probably meant this instead:

struct stuff_s {
  /* stuff */
};
typedef const struct stuff_s stuff_t;