This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

when #ifdeffing a testsnippet

when #ifdeffing a testsnippet it is, often, desirable to be able to do this:

code ....
code ....
#ifdef DOIT
BOOL flag
if (flag)
....

Keil does not allow definitions in the middle of a routine, IAR does.

is IAR wrong or is Keil "overly critical"?

since nobody here has a copy of the standard (gotcha sardine) I ask on the forum.

if, indeed, Keil is "overly critical", I'll put in a request.

Erik

Parents
  • is IAR wrong or is Keil "overly critical"?

    Neither. They only need to be at different revisions of the language definition to create that difference. Interspersed definitions are legal in C99, but not in C90. But the solution is easy: put an extra pair of braces around that code, and you'll be fine.

    since nobody here has a copy of the standard

    And shame on you for letting that happen. You have wasted several times its cost just trying to defend your decision not to have one in this forum alone --- and that's before we even consider the delay in getting information you could have had at your fingertips.

Reply
  • is IAR wrong or is Keil "overly critical"?

    Neither. They only need to be at different revisions of the language definition to create that difference. Interspersed definitions are legal in C99, but not in C90. But the solution is easy: put an extra pair of braces around that code, and you'll be fine.

    since nobody here has a copy of the standard

    And shame on you for letting that happen. You have wasted several times its cost just trying to defend your decision not to have one in this forum alone --- and that's before we even consider the delay in getting information you could have had at your fingertips.

Children