Re: data types
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Fri, 02 Mar 2007 21:19:47 -0500
Roberto Waltman wrote:
koolj96825@xxxxxxxxx wrote:
... an int could be 32-bit for PCs.
...but the manual for the compiler I am using says int is 16-bit.
Anyway, now that I need to go back over and look closely at my
code, my question is: is there a way to declare a variable say a
16 bit unsigned integer in C? Or is declaring it "short" the only
specifier that may work?
For non-C99 compilers, the common, non-portable way of doing it is:
typedef [whatever type is 16 bits in your platform] int16;
typedef [whatever type is 32 bits in your platform] int32;
and so on. Then use int16/32/etc. instead of plain int in your code.
Better to look at the range of values required and set your
fundamental types accordingly. Just don't bother with such
constraints as the above, as there may be no such type extant.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- References:
- data types
- From: koolj96825
- Re: data types
- From: Roberto Waltman
- data types
- Prev by Date: Re: question on variable definitions
- Next by Date: Re: C container and persistent library ?
- Previous by thread: Re: data types
- Next by thread: Re: data types
- Index(es):
Relevant Pages
|