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]

Re: hard typdef - proposal - I know it's not in the standard


On 23/01/13 08:55, Jonathan Wakely wrote:
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.

I was fearful of using the word attribute for fear of getting it wrong? What is "this part" of the compiler called (I'm doing this with gcc@gcc.gnu.org cced in for any future mes ;-))?
Are there any decent-sized documents on it? I'd love a good read!


Alec


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