Why does Windows API use UINT instead of unsigned int? And BOOL instead of bool?
And in openGL...
Why GLfloat instead of float? and GLint instead of int? Why are all these things different?
Why does Windows API use UINT instead of unsigned int? And BOOL instead of bool?
And in openGL...
Why GLfloat instead of float? and GLint instead of int? Why are all these things different?
They're just typedefs, they're exactly the same.
Win32 does it because it apparently fits in with their style of notation (called hungarian notation). However things like UINT double as a handy abbreviation.
As for GL I'm not sure but I'm guessing it's just a mechanism that helps any maintainer identify that this variable will be used by OpenGL.
Thor's self help tip:
Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.
OS: Windows XP
Compiler: MSVC
for example, an int may be of different sizes depending on what platform you are using.
Therefore cross platform libs such as opengl need to define their own data types so you can count on that the size of your data type is the same on all platforms.
Thanks! So for Win32, since I can't port it - I can just use things like int, char and whatever?
but in openGL its best to use GLfloat ect, so I can port it easily
correct?
> I can just use things like int, char and whatever?
Use the types specified in the win32 API.
Some of the underlying types actually changed from win16 to win32, but the typedef'ed name didn't change (to maintain compatibility with older code). If you use the current underlying types, you'll suffer when win64 comes along.
If you don't like the names, you could always do
typedef BOOL mywin32_bool;
But think carefully before doing this. You could end up with code which looks all wierd and unmaintainable to any other win32 programmer.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Actually this is a problem I forsee having with Windows programming. DOes anyone know where I can get hol of a list detaling the relations of windows API alternative data types to normal/original primitive datatypes?
Thanx y'all.
A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside
You have already that information, its all in the windows.h header heirarchy. Just go peruse it.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
If you don't want to mess in your headers (however it's more useful to learn it):
http://msdn.microsoft.com/library/de...data_types.asp
And btw: BOOL != bool (BOOL is in fact an unsigned integer i tought)
BOOL is bool
If you Right-Click on the variable (BOOL, UINT) and scroll down the menu to "Go To Definition" and click on that, it will show you the actual definition and answer many of your questions.
EDIT:
And my bad, BOOL is actually an integer (signed)....
Last edited by Epo; 01-02-2004 at 07:26 PM.