Hi there,
I need to know the size of the following types under ATmega128:
sizeof(short) = ?
sizeof(unsigned long) = ?
sizeof(float) = ?
Best regards
Hi there,
I need to know the size of the following types under ATmega128:
sizeof(short) = ?
sizeof(unsigned long) = ?
sizeof(float) = ?
Best regards
khalderon:
Hi there,I need to know the size of the following types under ATmega128:
sizeof(short) = ?
sizeof(unsigned long) = ?
sizeof(float) = ?
Best regards
What you ask are compiler questions rather than mega128.
We can say, that most commonly, but not certainly, C compilers are configured for 8 bit micros like the mega’s with a set of defintions as such below. You may redefine most these as you see fit,. in most any C compler (typedef).
For the various dialects of BASIC, there aren’t good conventions. Among them, I think ZBasic is the best designed - for its VM.
========
short = 16 bits
unsigned long = 32 bits
float = IEEE “single” - though most compilers require that you change the defaults for compliation and libraries to include, such as a vprintf()
Some compilers, like codevision’s, have an option for tiny memory modles where pointers are 8 bits; this makes code much smaller for chips with 256 bytes of RAM.
And for the mega128 and 256 don’t forget about looking at how well the compiler handles memory paging (RAMPZ); some use “far” pointers, etc. for doing byte-accesses to flash above 64K. The Program Counter is 16 bits and addresses words, not bytes, so it can cover 128KBytes of flash.
Thank you very much for the answer.