Microsoft Specific Data Types

Started by
10 comments, last by AndyTang 21 years, 11 months ago
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
Advertisement
bool isnt the same as BOOL
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?
Use whatever floats your boat ;-)

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
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
"bool" is a C++ type not a C type. BOOL is an int:

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

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
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!
rightclick on the type and choose go to definition

please learn to use your application

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

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
-- So Long To Red Dye #2
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.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

This topic is closed to new replies.

Advertisement