What does this macro mean?

E

Eric Fisher

#if #cpu(l64360)
#include <a.h>
#elif #cpu(lr333x0)
....
#endif

What does '#cpu' here mean?

Cheers,
Eric <<<
 
D

Dik T. Winter

> #if #cpu(l64360)
> #include <a.h>
> #elif #cpu(lr333x0)
> ...
> #endif
>
> What does '#cpu' here mean?

I think that should be written in the documentation of the compiler for
which that program was intended. It is far from standard.
 
J

James Kuyper

Eric said:
#if #cpu(l64360)
#include <a.h>
#elif #cpu(lr333x0)
...
#endif

What does '#cpu' here mean?

It is a syntax error in standard C. The '#' character gets parsed as a
punctuater, not as part of the same identifier as "cpu". While C does
recognize '#' as an operator, it does so only in the context of defining
the expansion for a macro name. The thing that immediately follows a #if
is supposed to be a constant-expression, with certain limitations; it
cannot contain a '#' punctuator. Therefore, a compiler that allows such
code to be compiled is implementing an extension to C (or possibly a
significantly different language that just looks like C), and it's
meaning will depend upon that compiler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,174
Messages
2,570,940
Members
47,484
Latest member
JackRichard

Latest Threads

Top