Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AndyTang

Microsoft Specific Data Types

This topic is 5916 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am doing some Directx and Opengl work. Is it better to use bool or BOOL and similar datatypes like UINT and unsigned int...? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
I know bool isn''t the same as BOOL, but what is the difference?

bool uses true and false
whereas
BOOL uses TRUE and FALSE

but in essence they have the same function right? If you use BOOL, you don''t need bool so which is better to use and what difference is there?

Share this post


Link to post
Share on other sites
least helpful posts ever. at least say STFW!

anyway,

my understanding is that the MS datatype BOOL is really an int. and TRUE is really 1 while FALSE is really 0.

i like to avoid the MS data types but that''s just b/c i like to make sure that whatever i''m compiling will also compile on Linux. or at least be as easy as possible to port when the time comes. obviously the MS data types don''t compile in linux...

if you''re writing MS code only use whichever.

-me

Share this post


Link to post
Share on other sites
"bool" is a C++ type not a C type. BOOL is an int:

typedef int BOOL;
#define FALSE 0
#define TRUE 1

Share this post


Link to post
Share on other sites
So apart from being able to compile in lunix there isnt really much difference? The only reason Im asking is that some example uses the C++ types and some uses these Microsoft types which doesnt just applies to BOOL but also CHAR, INT, LONG, etc...
Just confused why there are two types.

Thanks all!

Share this post


Link to post
Share on other sites
rightclick on the type and choose go to definition

please learn to use your application

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
sizeof(bool)=1 while sizeof(BOOL)=4
The other upper-case datatypes are just typedefs(located in wtypes.h) of the normal ones.

--
So Long To Red Dye #2

Share this post


Link to post
Share on other sites
Perhaps the idea was that using all caps would make it easier to redfine the types in the future - or to define them for different processors, but more likely the idea was to make it easier to distinguish the variable type from the variable name - especially considering their use of hungarian notation.

Another silly convention MS uses pertains to the kind of calls api functions use. The vast majority of them are __stdcall - but MS gives them all sorts of names - WINAPI, APIENTRY, WINOLEAPI, STDMETHODCALLTYPE, RPC_ENTRY - and more.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!