Were GNU C extensions proposed for the standard?
Paul Burry
paul at dy4.uucp
Wed Jan 17 06:27:41 AEST 1990
While we're on the subject of useful extensions to C
(like "typeof"), I was wondering if any of the other GNU C
extensions were proposed as new features in ANSI C.
Some of GNU C's more useful extensions (IMHO) are:
o the addition of the "typeof" keyword
o the addition of the "inline" keyword
o the addition of the "alignof" keyword
o statements and declarations inside of expressions
ie.
#define max(a,b) \
({ \
int _a = (a); \
int _b = (b); \
_a > _b ? _a : _b; \
})
(on a side note, why didn't ANSI C define a way to avoid
shadowing external variables in a macro defining?)
o generalized lvalues
ie.
allowing expressions, compound expressions and casts as lvalues.
o arrays of zero length
o arrays of variable length
ie.
some_function(int n)
{
char array[n];
:
}
o non-constant initializers allowed for aggregates
ie.
foo(float f, float g)
{
float array[2] = { f-g, f+g };
:
}
o application of volatile and const to functions
ie.
volatile functions do not return (like exit(), abort()).
const functions produce no side effects (like sin()).
There are a number of other extensions, but I think that these are the
most useful.
If these extensions were proposed, what was the justification for denying
their inclusion in the standard?
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Paul Burry PHONE: (613)-596-9911
UUCP: ...!cognos!dy4!paul POST: Dy4 Systems Inc., 21 Fitzgerald Road,
or ...!cognos!dy4!seu13!paul Nepean, Ontario, Canada K2H 9J4
More information about the Comp.lang.c
mailing list