usage of uin16_t

P

Pavan

Hi Can you clarify following questions regarding uint16_t

1> Does uint16_t is supported by Windows compilers also? If not on
checking what define, I should typedef. I mean to say for eg:
#ifdef WIN32
typedef unsigned short uint16_t;
#endif

2> When I use uint16_t am I always guaranteed that it cannot hold more
than 16 bits
Eg: uint16_t x = 0xffffffff; // Is it always guaranteed that the value
written is only 0xffff
 
A

Alf P. Steinbach

* Pavan:
Hi Can you clarify following questions regarding uint16_t

1> Does uint16_t is supported by Windows compilers also?

Presumably the "also" means that you're currently using some non-Windows
compiler where there is support for uint16_t.

Type "wikipedia uint16_t" in the Firefox address bar served up a list of Google
hits; the first was <url: http://en.wikipedia.org/wiki/Stdint.h>.

And that article says "The exact-width types and their corresponding ranges are
only included in that header if they exist for that specific compiler/processor.".

By the way, if a particular compiler doesn't offer [stdint.h] then check out the
Boost equivalent.


2> When I use uint16_t am I always guaranteed that it cannot hold more
than 16 bits
Eg: uint16_t x = 0xffffffff; // Is it always guaranteed that the value
written is only 0xffff

See above. That is, as we said in the old days, RTFM. :) Of course, you'd have
to find the/a manual first, but it's not really that hard (see above).


Cheers & hth.,

- Alf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top