Klaus, > The difference between long and int is machine dependend. Actually, it is compiler defined. > int depends from the processor type, that means int is 16 bit on a 16 > bit machine and 32 bit on a 32 bit machine. int is supposed to mirror the natural word width of the machine, yes. > long is at least 32 bit. Correct. > short is allways 16 bit. No, short is required to cover the closed interval [-32768, 32767]. That does not infer 16 bitness for short--short *can* be modeled with a 32-bit type (cf 320C40 compiler cited in a previous message). > The best way to write portable code is to define your own datatypes. > > i.e. for a 32 bit architecture > > #define u8 unsigned char > #define u16 unsigned short > #define u32 unsigned int Or try <stdint.h> and use uint_8 and so on... -- Paul.
Message
RE: [lpc2000] unsigned long versus unsigned int on ARM7
2005-11-09 by Paul Curtis
Attachments
- No local attachments were found for this message.