[Coco] Found strangeness in C compiler (bug)
alsplace at pobox.com
Tue May 21 09:23:31 EDT 2019
> On May 21, 2019, at 8:16 AM, Mathew Boytim via Coco <coco at maltedmedia.com> wrote:
> not strictly legal. We use IAR for a lot of embedded development and the IAR compiler/optimizer is pretty kind in that it seems to do things as you would want or expect but aren't strictly legal/defined. On the other hand I find the gcc compiler/optimizer to be 'greedy' in that it takes advantage of the strict definition when it wants to. I frequently encounter programmers complaining of bugs in gcc because things that they routinely do with IAR don't work with gcc - but in all cases gcc has been right.
I used IAR at a recent job. I know we “complain” about issues with these ancient K&R compilers from the 1980s, but I found some odd limits in “modern” supported compilers. It was either IAR or Renasas that had a cryptic error if you had a string longer than 80 characters or something pretty small!
char * string = “If this is too big, it would give you an error that you had to look up because it did not make any sense.”;
I guess the biggest thing we’ve gained with modern tools is they have much better error reporting, and we can search the web to see what they mean.
I am hoping I can slide back into K&R C for updating some of my old projects. I assume using ANSIFRONT is going to bloat my code a bit — especially if I use things like unsigned char where it puts in “ch & 255” everywhere (if I recall).
I guess if ANSIFRONT is standard with NitrOS-9 these days, maybe I should just go that route. It sure would be easier.
More information about the Coco