|
|
I can use #error, #warning, etc. to output interesting text. Is there any
way to include the location of the problem?
Something like:
#if (foo>bar)
#error concat ("Your object is impossible. Stopped at ", __LINE__,
"\n")
#end
Post a reply to this message
|
|
|
|
John M. Dlugosz wrote:
>
> I can use #error, #warning, etc. to output interesting text. Is there any
> way to include the location of the problem?
>
> Something like:
>
> #if (foo>bar)
> #error concat ("Your object is impossible. Stopped at ", __LINE__,
> "\n")
> #end
Doesn't the #error directive already spit out the line number of the source?
Post a reply to this message
|
|
|
|
Yes it does -- bad example. But #warning doesn't.
Better yet, I need a "caller". For example, a macro that is configured with
symbols will spit out things like:
#ifndef (Column_Flute_Mode)
#declare Column_Flute_Mode= 1; //if not specified, use Normal
#warning "Column_Flute_Mode defaults to 1 (Normal)\n"
#end
which is a handy way to tell the user of this macro about configuration
parameters he might not be aware of. The __LINE__ would tell me where the
#warning was located, and from there figure out that it had to do with this
particular macro. But a "caller", like in Perl, would tell me which
invocation of this macro is causing the noted effect. E.g.
archway (25, 14, 7) // warning points to THIS line, generated by
archway macro,
// saying that the middle parameter is not to its liking.
--John
John VanSickle wrote in message <36D20433.9BBBD359@erols.com>...
>John M. Dlugosz wrote:
>>
>> I can use #error, #warning, etc. to output interesting text. Is there
any
>> way to include the location of the problem?
>>
>> Something like:
>>
>> #if (foo>bar)
>> #error concat ("Your object is impossible. Stopped at ",
__LINE__,
>> "\n")
>> #end
>
>Doesn't the #error directive already spit out the line number of the
source?
Post a reply to this message
|
|