Sometimes, beeing a GNU compiler manufacturer is difficult! People blame you for stuff that actually is implemented correctly. A popular mistake involves multiple pointer declarations!


char a;
char b;
char c;

The statement above can be merged into a single instruction easily:

char a, b, c;

Now take a look at this:

char* a;
char* b;
char* c;

Simplifying this with common sense leads to:

char* a, b, c;

But be careful-this does not do what you want it to. The star operator ties to the variable name and not to the type. So, you would end up with a char pointer a and two char variables b and c.

The correct way of simplification looks like this:

char *a, *b, *c;

This mistake happens often. It gets even more complicated when macros/typedefs are involved. Thus, if you ever see multiple pointers defined in a single instruction-be careful!
Did you ever have such a problem?

Related posts:

  1. Globals in DAs
  2. On foo, bar and baz
  3. The many faces of ’static’
  4. Fix padding issues in structs
  5. PODS and variables or standards vs. comfort