Irr primitive datatypes

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
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Irr primitive datatypes

Post by chronologicaldot »

More of a question of curiosity - I'm not asking for help on something.

I noticed in CMeshSceneNode::OnRegisterSceneNode, lines 61 and 62, someone had used "int" instead of the usual s32.
I'm curious as to when and for whom the data types have been an issue. Seems to me I can get "int" and "unsigned int" to compile fine on both Linux and Windows despite their differences in the irrTypes files. So I'm just curious as to why they are both defined differently in irrTypes. I can understand the compiler differences, just not the _MSC_VER / Ansi one.

In short, my question is, isn't it fine to just use "int"? Where would I hit issues (aside from telling other people to compile my code)?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irr primitive datatypes

Post by CuteAlien »

u32 would be better in that case as that's the amount of elements which the loop could have.
Just a nicer-to-have in this case to avoid it being different in just one place in the code. The size of int depends on the platform (especially 32 bit vs 64 bit). Working with a fixed size matters for example in loading & saving binary formats where the same amount of bytes must be read/written each time.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Irr primitive datatypes

Post by chronologicaldot »

Wow - I can't believe I forgot about that.
Thanks for the reply!
Post Reply