Sujet : Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 25. Mar 2025, 17:31:45
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250325092315.416@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-03-25, David Brown <
david.brown@hesbynett.no> wrote:
Personally, I think "typedef uint8_t byte;" /is/ ideal - and much better
than "typedef unsigned char byte;" would be. I say that as someone who
works in a field with bits and bytes more than ints and doubles.
The problem is that uint8_t is not endowed with the special
aliasing rules for accessing objects of other types as arrays
of unsigned char. A type called byte is prone to precipitating
into those uses.
A platform like Arduino could assert that in their toolchain,
the type byte does have those properties (and then somehow ensure
that is true, in spite of it being uint8_t, like by patching
the compiler if they have to).
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca