This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC aliasing extension for C


I know that GCC implements a C extension (which is more or less required by POSIX) which allows you to define a buffer

  char buf[1024];

and then allocate objects from that (assuming that the buffer is sufficiently large and the pointers to subobjects are suitably aligned). In short, it is possible to change the dynamic type of an object even if it was defined with a type.

The object is first written under the new type, and only accessed under the new type. It is also possible that the buffer is reused and different objects with different types at the same offsets are carved out from it.

Is this a property of the char type, or would other types work as well, for example, double or long double?

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]