A few years ago I mentioned on these forums that I work with a compiler on my school robotics team that has a 24-bit "short long" data type. Well, I've finally found out what compiler the software uses (it's a GUI-based programming software called EasyC V2, made by Intelitek: http://www.intelitekdownloads.com/ ).
As you can see it, supports all of 8 bit, 16 bit, 24 bit, and 32 bit integral types, with "int" being 16 bits. I wonder why/how this is implemented? I don't know much about the microconctroller that the compiled HEX files are downloaded to, but for the Cortex microsontrollers we use different software (EasyC V4) that uses a GCC compiler set to target arm-none-eabi.
What do you think? A 24-bit data type along with the other 8, 16, and 32-bit types seems pretty strange.
Well, let's forget the why, I'm sure there was a good reason. I just want to discuss this because it's interesting. How did they do it if the native word size is 16 bits?
Data types of any even length is perfectly fine; a structure in C++ can easily be 24-bytes in length, too. Though, "short long" is a type with an identity crisis; it's contradictory.
LB wrote:
"How did they do it if the native word size is 16 bits?"
...by reading two words from memory, concatenating the words and then discard the unused bytes.
Is this HEX the raw machine code? Do you know what architecture for? If so, you could write some tiny programs (involving short long and arithmetic with it) and post HEXes for those...
That's awesome :D . Our school was doing a VEX club that I was going to program for, before the teachers went on strike and closed it down before we could really do anything with them T.T.
Also if its Vex then its a PIC or a Cortex-M3 architecture :O
C:\Program Files\Intelitek\easyC V2 for Vex\Mcc18\bin>mcc18 -I=../h/ test.c
MPLAB C18 v2.40 (feature limited)
Copyright 1999-2004 Microchip Technology Inc.
This version of MPLAB C18 does not support the extended mode
and will not perform all optimizations. To purchase a full
copy of MPLAB C18, please contact your local distributor or
visit buy.microchip.com.
WARNING: This version of MPLAB C18 does not support procedural abstraction. Pr
ocedural abstraction will not be run.
C:\Program Files\Intelitek\easyC V2 for Vex\Mcc18\bin\test.c:3:Error [1157] func
tion 'main' should be declared as 'void main (void)'
C:\Program Files\Intelitek\easyC V2 for Vex\Mcc18\bin\test.c:6:Warning [2066] ty
pe qualifier mismatch in assignment