Reputation: 11151
You can put a link to comparison matrix or lists of extensions available to main compilers. If none of this is available, you could write a list of extension you use or like in your favorite compiler.
Upvotes: 2
Views: 335
Reputation: 239041
Well, this depends on whether you mean C89 or C99 when you say "ANSI C". Since most mainstream implementations aren't fully C99-compliant yet, I'm going to assume C89.
In that case, I'd say (and not including specific APIs like POSIX or BSD Sockets):
long long
must be the most common extension;union
members other than the last written;inline
is probably up there;snprintf
is available in a lot of places;alloca
Edit: Ahh yes, how could I forget the ubiquitous //
style comment.
Upvotes: 2
Reputation: 23138
http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html#C-Extensions
http://gcc.gnu.org/c99status.html
Upvotes: 5
Reputation: 400274
A number of compilers allow anonymous structs inside anonymous unions, which is useful for some things, e.g.:
struct vector3
{
union
{
struct
{
float x, y, z;
};
float v[3];
};
};
// members can now be accessed by name or by index:
vector3 v;
v.x = 1.0f; v.y = 2.0f; v.z = 3.0f;
v.v[0] = v.v[1] = v.v[2] = 0.0f;
Upvotes: 1
Reputation: 80276
In one of the notorious compilers for embedded C, you can specify little- or big-endian for a struct type independently from the processor's preference. Very convenient for writing device drivers, if you remember not to access one of the fields through (say) an int*
that forgets the endianness.
Are you serious with the feature matrix thing? Do you think SO members have nothing better to do?
Upvotes: 1