Hi,
Today I wondered why SDL re-defines only int types ? Why not float,
double,char…
Bye
Lawouach
Hi,
Today I wondered why SDL re-defines only int types ? Why not float,
double,char…
Bye
Lawouach
chellegouarch wrote:
Hi,
Today I wondered why SDL re-defines only int types ? Why not float,
double,char…
i guess it is a story size…
float is always 4 bytes and double 8 bytes.
but int is size of a register. which can vary across different computer.
the idea is that Uint32 is always 4 bytes…
Today I wondered why SDL re-defines only int types ? Why not float,
double,char…
Just a guess, but prob cuz they aren’t used internally?
-bill!
Today I wondered why SDL re-defines only int types ? Why not float,
double,char…
char is an integral type, and SDL defines Uint8/Sint8 for your pleasure.
The typedefs are used when integers of very specific sizes are needed, such
as pixels and sound samples. They are used both to provide platform-
independence from the compiler’s own types and (equally important) to
convey intent in the code.
SDL uses very little floating-point internally and specific sizes are not
crucial for that code. Remember, always use the basic C types (int, char,
long etc) unless your code depends on a type being of a certain size