UNIT

Oct 27, 2014 at 1:14pm
in my exercise, i found that there is a new datatype called "UNIT", i wonder whether it is unsigned int or not???
Oct 27, 2014 at 1:14pm
it's UINT. and it's not new.
and guess what the U stands for? :)
Oct 27, 2014 at 1:34pm
so UNIT and unsigned int are different?
Oct 27, 2014 at 1:36pm
can you explain it to me??

what is UNIT used for?
Oct 27, 2014 at 4:41pm
i don't know what UNIT is...
Oct 27, 2014 at 4:44pm
Is it UINT or UNIT? UINT sounds like a typedef for unsigned int.
Oct 27, 2014 at 6:16pm
sorry

UINT
Oct 27, 2014 at 11:29pm
Yes, UINT is (as far as I remember) a typedef for unsigned int, used in the Windows API (and maybe other places, too). See http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#UINT
Last edited on Oct 27, 2014 at 11:30pm
Oct 28, 2014 at 2:10am
So int c plus plus we have to

typedef unsigned int UINT

before using it????
Oct 28, 2014 at 2:22am
why dont we use unsigned int?? why we have to define UINT??? what for??

- thks-
Oct 28, 2014 at 5:48am
We don't have to typedef it, not normally. Generally windows headers (e.g. #include <windows.h> ) will define it for you.

Generally, the reason for typedef is to separate it conceptually from something else. However, in this case I think its more so for the typedefs of PUINT or the like, which windows defines.

In short, yes you can use unsigned int, and the compiler won't care. However, if you do lots of programming for Windows, often you'll use their typedefs to fit in with the overall API.
Oct 28, 2014 at 1:37pm
i typedef it and it run nomally
Topic archived. No new replies allowed.