Page 1 of 1

difference between u32 vs s32 and pointer in irrlicht

Posted: Sun Sep 02, 2012 6:47 pm
by caiten
HI ALL

i am newbie .i have question;
+how to use u32 and s32 ?
+IrrlichtDevice *irrDevice .how to pointer *irrDevice use ?
IrrlichtDevice is class or struct ? i can't find in include file

thankss. my english is bad

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Sun Sep 02, 2012 7:01 pm
by CuteAlien
Hi caiten,

u32 and s32 (or irr::u32 and irr::s32 with explicit namespace) are just typedefs for integer types with 32-bit size.
IrrlichtDevice documentation is here: http://irrlicht.sourceforge.net/docu/cl ... evice.html

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Sun Sep 02, 2012 7:42 pm
by Mel
-u32 and s32 are unsigned and signed 32 bits integers and can be used as such.
You should program more so you get used to pointers, classes and structs. :)

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Sun Sep 02, 2012 9:54 pm
by d3jake
I agree with mel: Get used to working with classes and structs before using the engine; you'll thank yourself later.

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Mon Sep 03, 2012 8:06 am
by caiten
CuteAlien wrote:Hi caiten,

u32 and s32 (or irr::u32 and irr::s32 with explicit namespace) are just typedefs for integer types with 32-bit size.
IrrlichtDevice documentation is here: http://irrlicht.sourceforge.net/docu/cl ... evice.html
but i replace u32 and s32 in example :

Code: Select all

IrrlichtDevice *irrDevice = createDevice(EDT_OPENGL,
                                          dimension2d<irr::u32>(1000, 1000),
                                          16,
                                          false,
                                          true,
                                          0);
visual studio display:

1>main.cpp(25): error C2664: 'irr::createDevice' : cannot convert parameter 2 from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'
1> with
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> Reason: cannot convert from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T>'
1> with
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Mon Sep 03, 2012 8:53 am
by hybrid
Well, the error clearly says that you pass in s32, not u32. While your code fragment shows it different. So either you have some more createDevice somewhere, or you didn't compile the code you showed here.

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Mon Sep 03, 2012 9:30 am
by Mel
C++ enforeces the strict usage of types, so you can't exchange from u32 to s32 in a template freely because they end being diferent types. And besides, it is not safe to cast s32 variables to u32 variables because there is the posibility that the sign can't be converted properly.

The createDevice function parameters have their own types, as all of the classes and structs in Irrlicht and in C++ in general, and you should use parameters of the proper type only. That is basic programming knowledge. Get used to it.

Re: difference between u32 vs s32 and pointer in irrlicht

Posted: Mon Sep 03, 2012 2:09 pm
by caiten
thanksss all you