CodeWarrior for HCS12X - ANSI-compliant??

Hey folks,

i got some strange problems with CodeWarrior for freescale's HCS12X family. On various occasions it complains about variable types like "uint8_t" not being defined. As far as i know, uint8_t is required by ANSI-C though as some fixed-size type.

Am i plain wrong here or does codewarrior behave strange indeed??

TIA, Florian

Reply to
Florian E. Teply
Loading thread data ...

Did you included stdint.h?

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

I tried to, but the compiler can't find stdint.h (it's not even on disk, i verified that at first). It's defined in PE_Types.h (some custom stuff for freescale's Processor Expert) though, which i included. On the other hand, redefining the function as to return byte doesn't do the trick either :-(

Greetings, Florian

Reply to
Florian E. Teply

As another strange sidenote: uint8_t is used several times in the same file, and works as it should on every single occasion, as long as the line number doesn't exceed 500...

Greetings, Florian

Reply to
Florian E. Teply

As Frank Buss has pointed out, make sure that you have included stdint.h. However, stdint.h is only defined in the ISO C99 standard and not the original ANSI C specification.

--
Andrew Smallshaw
andrews@sdf.lonestar.org
Reply to
Andrew Smallshaw

Umm, this may explain the missing stdint.h even though C99 is around now for quite some time... Funny thing is: it's defined here in PE_Types.h which i included. And the compiler doesn't complain about it the first two dozen times, but after about line 550 it has forgotten about that and several other standard types and #defines :-(

Greetings, Florian

Reply to
Florian E. Teply

Ouch, found the mistake i was making: I had one pair of curly brackets left unclosed...

I better check that more thoroughly next time.

Sorry for the noise Florian

Reply to
Florian E. Teply

That is required only by C99 (not earlier standards) and even then only if available on the hardware. However the various forms of char (un/signed/char) are always available.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.


** Posted from http://www.teranews.com **
Reply to
CBFalconer

... snip ...

Please explain how an 8-bit value can express a number outside the range 0 .. 255.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.


** Posted from http://www.teranews.com **
Reply to
CBFalconer

Yeah, sometimes it's good to periodically put your code through indent or an editor with comparable capability.

Not only makes it more readable, but often a fast way to catch unexplained mystery errors.

IDE's are nice, but the problem with having so many of them is that you end up with so many different editors.

Reply to
cs_posting

Maybe i didn't make this clear: the uint8_t variable is indeed limitet to the range 0..255, but the 500 i was referring to, was actually the line number in the source code. Anyways, my guess that this could be related was proven wrong when i found that i missed a closing bracket...

Greetings, Florian

Reply to
Florian E. Teply

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.