linux-il  

Re: With and Without gcc OMP

Oleg Goldshmidt
Tue, 25 Sep 2007 02:59:43 -0700

"Nadav Har'El" <[EMAIL PROTECTED]> writes:

> Why is #pragma a "preprocessor directive"?

Because it is processed by the preprocessor. Some pragmas have a
meaning for the preprocessor itself, some others only have a meaning
for the compiler.
 
> The fact that it starts with "#" doesn't make it a preprocessor
> directive, and a good example is "#line" which in used by the C
> compiler, not preprocessor (in fact, the preprocessor generates
> lines like this).

No, #line is in fact used by preprocessor, at least in certain
cases. And it is not necessarily generated by the preprocessor. The
typical case is when you have a tool that generates C code for you
(e.g., lex/yacc or flex/bison) and you want to modify the
preprocessor's (and the compiler's) notion of the current filename and
line number. E.g., if there is a diagnostic output in the code you
might want it to indicate the original yacc source filename and line
number, not those of the generated C code.

To convince yourself that the preprocessor uses #line, consider that
it is taken into account when the __FILE__ and __LINE__ macros are
expanded, which is, of course, a preprocessor function.
 
> Anyway, Orna, can you perhaps use this _Pragma operator that Oleg
> points to? (I don't know if your compiler has this feature or not,
> but it's worth trying, I guess).

As I pointed out, I suspect that this may be unacceptable because it
will only work in C99 compliant implementations.

Orna, I am sure you will treat all of this as design suggestions and
considerations, not as statements of what is right or wrong. Do what
*you* think is right for *your* purposes.

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] | http://www.goldshmidt.org

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]