int vs s32

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
pippy
Posts: 49
Joined: Sun Jul 08, 2007 11:31 pm

int vs s32

Post by pippy »

Is there really any difference between say double and f64? whats the point in the irrlicht version of these numbers?

I understand that on really old computers they had different sizes for numbers, but I don't think that Irrlicht would be able to run on those types of machines anyway

Is it just for potential, eg in a 386 a int has somewhere around 60k values, so when the user compiles on that machine he can specify the s32 to have four ints?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The idea is to make it so that you have control over the size [and range] of the values. If you want a 32-bit unsigned integer, you use u32. If you tried to use unsigned or unsigned long you might actually get a 64-bit quantity on some platforms.

Travis
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The f32 typdef could also be used for fixed point classes to come in on machines without a hardware FPU. And yeah, if you'd use a s32/u32 type with less than 32bits you'd be in great trouble.
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Umm, and also it is part of the API, and basically standard. Almost every other API either uses sXX uXX, or qword, dword etc.

I mean it is just a way to make a standard. Look at Insomniac Games code for Resistance. They also use a naming convention, and not C types.
TheQuestion = 2B || !2B
constchar*
Posts: 14
Joined: Thu Sep 20, 2007 3:57 am

Post by constchar* »

Another reason you'd use typedef's is for cross-platform compatibility
so say you port your application to platform X and say platform X doesn't
support a certain type so then you can just change the typedef to something
related without having to edit the entire engine.
Post Reply