Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
debate: char vs. byte
takeshimiya:
--- Quote from: tiwag on August 23, 2005, 10:29:07 am ---
--- Quote from: takeshimiya on August 23, 2005, 10:13:37 am ---..char typedefed as byte or wxByte would be good.
--- End quote ---
i always used "byte" as typedef'ed "unsigned char"
--- End quote ---
That's an horror! :D
In that case, typedef the byte as char
and ubyte as unsigned char.
If not, you'll be against the world. :lol:
takeshimiya:
Also, talking about integer types, EVERYONE in the world trying to do portable and optimized use of integers would be using the typedef's provided by the ISO/IEC C++ standard, by including <inttypes.h> (which includes the header <stdint.h> and extends it with additional facilities provided by hosted implementations.)
Example of what EVERYONE should be using:
/* 7.18.1.1 Exact-width integer types */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
/* 7.18.1.2 Minimum-width integer types */
typedef signed char int_least8_t;
typedef short int_least16_t;
typedef int int_least32_t;
...
/* 7.18.1.3 Fastest minimum-width integer types
typedef char int_fast8_t;
typedef short int_fast16_t;
typedef int int_fast32_t;
...
And so on. :)
me22:
--- Quote from: takeshimiya on August 23, 2005, 07:40:34 pm ---Also, talking about integer types, EVERYONE in the world trying to do portable and optimized use of integers would be using the typedef's provided by the ISO/IEC C++ standard, by including <inttypes.h> (which includes the header <stdint.h> and extends it with additional facilities provided by hosted implementations.)
--- End quote ---
Sorry, but neither of those are ISO C++ standard headers.
What people /should/ be using is <boost/cstdint.hpp> if they absolutely need fixed-size types, although the normal types are just fine -- they do have minimum range garuntees. The best ones, though, are the ones in <boost/integer.hpp>, which let you pick types based on the largest/smallest values you want to store in them. Certain-size types are no good even for file I/O, though, because of endian issues.
tiwag:
--- Quote from: takeshimiya on August 23, 2005, 07:29:52 pm ---That's a horror! :D
--- End quote ---
? :shock:
everywhere in the world, since microcontrollers have been developed,
byte's and word's are unsigned and only reflect the size of 8 and 16 bits respectively.
BASTA
don't decompose my old-fashioned view of live :lol: !
btw. ubyte - what's that ? some new kind of flu ?
rickg22:
Please keep the discussion on-topic, people... this was meant to be the unicode thread, not the byte vs. char vs. yards and meters debate. :P.
Navigation
[0] Message Index
[#] Next page
Go to full version