hard typdef - proposal - I know it's not in the standard
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Jan 23 08:55:00 GMT 2013
On 23 January 2013 06:53, Alec Teal wrote:
> Why not:
>
> make an "optional keyword", "hard", have a meaning if before "typedef", I
> suggest tokenising "hard" as a normal token (however it is processed now why
> change it? I am not sure on GCCs exact grammar for c languages) but if AND
> ONLY if it is before a "typdef" treat it differently, as far as I know a
> typedef can only occur at the beginning of a statement so this should mean
> it doesn't break anything.
Like other specifiers such as const and static, typedef doesn't have
to come first, i.e. this is legal, if unconventional:
typedef int hard;
hard typedef Int;
I think Basile's suggestion to implement it as an attribute is a
better idea, it makes it clearer it's something non-standard and
compiler-specific, and the grammar already contains attributes in
declarations.
> Problems:
>
> 1)Not all compilers would be happy with this.
> Fix:
> I'm sure gcc must define something for the preprocessor that'll exist if and
> only if GCC is the compiler?
Nope, Compilers that claim GCC compatibility also define __GNUC__, and
as has been discussed before on this list, if we added __REALLY_GCC__
then other compilers would just add that too.
More information about the Gcc
mailing list