avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bug #34695] fixed width int types without __attribut


From: Georg-Johann Lay
Subject: Re: [avr-libc-dev] [bug #34695] fixed width int types without __attribute__(mode)
Date: Tue, 01 Nov 2011 13:10:44 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

David Brown a écrit:

While I agree with your principle here, I think there is good reason for changing the typedefs in this case - and nothing to lose. People use different tools with their code, such as static error checkers, documentation generators, and "smart" editors like Eclipse. They also sometimes read the files.

The use of __attribute__((__mode__)) as the sole way to define sizes seems to me to be gratuitously non-standard. I am all in favour of using non-standard constructs or extensions when they are a help - making source code clearer, shorter or more readable, letting the compiler generate smaller or faster object code, or simply implementing features that can't be expressed in standard C. But this is not such a case.

-mint8 is non-standard C

I also wonder if there are differences in the way gcc treats "mode" attribute definitions from standard definitions. In particular, in C a "unsigned char" is /not/ identical to an "8-bit unsigned int". The "unsigned char" has different aliasing properties than an "unsigned int" of any size. Will code that relies on the these aliasing properties work correctly with "uint8_t" as defined in avr-libc? And will it /always/ work correctly, with future versions of avr-gcc?

Aliasing is a good point.

But as the moment discussing -mint8 features is void because that feature is broken some time now (PR46261).

Johann



reply via email to

[Prev in Thread] Current Thread [Next in Thread]