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
For pure 'C', Keil is correct.
Are you sure you haven't got IAR in "C++" mode?
Could you do this:
code .... code .... #ifdef DOIT { BOOL flag if (flag) .... } #endif
Are you sure you haven't got IAR in "C++" mode? who knows, I am now consulting elsewhere, using Keil.
Also, I would be extremely surprised if a C/C++ compiler was totally without allowing any 'innocent' C++ in "C mode", '//' was accepted by many C compilers before it became "legal"
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.
And shame on you for letting that happen.
I have no control over what the place I am consulting posess.
You do have control over your own toolbox, though. And the definitive explanation of the programming language you're using belongs in there, period.
You do have control over your own toolbox, though.
I've heard a few people talk about a system called the World Wide Internet Web Thingy or something like that. Looks really cool. Apparently you can do searches and get documents and look at reference manuals and do all sort of other clever things on it. A bit like a souped up library.
Might be worth a gander?
I think that the masters of the 'C' standard are still of the beleif that it should not simply be made available to all-and-sundry on this new fangled interweb thingy.
They retain the old-school ways that you have to pay to get a copy of their work.
So, yes, if you want to reference the 'C' standard (or standards) you do still have to buy your own copy, or be able to borrow someone else's.
They do however make draft versions available *absolutely free* in handy pdf format on the internet. The drafts are so close to the final version that there is little point in paying for it.
Including C90 ?
RE: Apparently you can ... get documents
Oh, I should obviously have said: You can get access to documents which you'd previously acquired, in a perfectly legitimate manner for an acceptable cost, and uploaded to a suitable site for your later perusal via a compatible web browser at a time and a place not defined when the upload occured.