Olly> I'm unsure how `int a[0];' will be handled by various compilers.

Tom> gcc accepts this as an extension.  It is useful when using the
Tom> "struct hack", at least.

Akim> I don't understand what you are referring to.  Could you give details?

In C you can write something like this:

  struct foo
  {
     int fixed_part;
     char buffer[1];
  }

Then when you allocate a "foo" you over-allocate, and use "buffer" as
a string -- you assume that your over-allocated parts immediately
follow "buffer".

Paul says the current C standard doesn't allow this, but I thought
there was a special exception precisely to allow it.  Anyway, it is a
very common practice.

Tom

Reply via email to