Im working on a sparetime project, making some server code to an Arduino Duemilanove, but before I test this code on the controller I am testing it on my own machine (An OS X ba
The correct way to handle the situation is to choose the type based on the values it will need to represent:
int
;long
;long long
.short
(or signed char
, if the range -127 to 127 is OK).As long as you have made no other assumptions that these (ie. always using sizeof
instead of assuming the width of the type), then your code will be portable.
In general, you should only need to use the fixed-width types from stdint.h
for values that are being exchanged through a binary interface with another system - ie. being read from or written to the network or a file.