Bjørn Augestad wrote:
Here is the exact code causing problems. It's from the libclc file
clc_settings.h and causes problems on the st20cc cross compiler v. 1.9.6
(windows version) for the os20 embedded os:
/* Handle differences between C89 and C99 */
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
# define CLC_RESTRICT
#else
# define CLC_RESTRICT restrict
#endif
Thanks again to all. I'll experiment more with the compiler on monday
and try to come up with a portable and working solution.
Actually, the `defined' piece is unnecessary:
#if __STDC_VERSION__ < 199901L
is a portable solution, because any unrecognized identifiers
in an #if or #elif directive are replaced with zeroes.
Another formulation found favor with pre-Standard compilers,
some of whose preprocessors simply deleted unrecognized names
in such expressions:
#if __STDC_VERSION__ + 0 < 199901L
the idea being that you'd wind up with `value + 0' or with
`0 + 0' (the Standard answers) or with unadorned `+ 0' (for
some pre-Standard compilers). You might want to see if this
old dodge might calm your compiler's nervousness.
Finally, there's Arthur O'Dwyer's suggestion, using the
defined-ness of __STDC_VERSION__ to govern the definition of
an "intermediate" symbol, and then testing that symbol. For
the case at hand, you could eliminate the intermediate with
some extra coding:
#ifdef __STDC_VERSION__
#if __STDC_VERSION__ >= 199901L
#define CLC_RESTRICT restrict
#endif
#endif
#ifndef CLC_RESTRICT
#define CLC_RESTRICT /* nil */
#endif
This, I think, stands the best chance of quieting the
whines -- but nothing's guaranteed; the compiler is within
its rights to complain about the vapidity of American beer,
if it so chooses. It must, though, accept and translate
your code (barring other problems, of course).
----
--
Er*********@sun.com