newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Fri Sep 30, 2016 7:49 am |
|
|
septillion wrote: | I did not specify the unsigned type because the CCS Help says "Unsigned: Data is always positive. This is the default data type if not specified.". But I agree it's nicer to specify it specifically. |
You have to be a little bit careful regarding the types. With the PCB, PCM and PCH compilers (basically PIC10 - PIC18 families), the default for all variables is unsigned. With PCD (PIC24, PIC33), the default is signed. Made for some really weird behaviour when I migrated a project developed using a PIC18 to a dsPIC33. From that point on it became my standard practice to explicitly declare the variable type for every variable I use.
I must admit that the CCS compiler has spoiled me a bit. Earlier this year a Linux project I was supporting was migrated from kernel 3.12.something to 4.0.something (running on a beaglebone black). A program I wrote for the older kernel no longer worked when recompiled using the updated compiler/libraries. Traced the issue back to the compiler not properly dealing with variables smaller than the native width of the processor: 32 bits. Never had that sort of issue with the CCS compiler. |
|