[comp.lang.c] User introduced compiler warning, was Re: Behavior of #error

datangua@watmath.waterloo.edu (David Tanguay) (01/15/91)

>In article <1192@van-bc.wimsey.bc.ca> jtc@van-bc.wimsey.bc.ca (J.T. Conklin) writes:
>Has anyone experimented with user-introduced warning messages in C? In
>any other language?  Do they work, or do programmers neglect to use
>them?  Is there a real need for such a feature?

I've been using our compiler's #pragma warning "string" directive lately
for code development, sort of a note book for things that aren't yet
implemented, or should be extended or optimized or whatever. The pragma
causes the compiler to generate a warning message, so I'll see it all the
time during development and not forget that I have to fix something.
It's much less ignorable than
	/* someday we should renooberate the frozbit */
or	/* subcommand BLAH is not yet implemented */
and it is especially noticeable by code inheritors.

I've found it very convenient, but more organised people (i.e., those who
keep notebooks, or have a memory that works) probably don't need it.
It's a nice use for a pragma, though.
-- 
David Tanguay            Software Development Group, University of Waterloo

gwyn@smoke.brl.mil (Doug Gwyn) (01/16/91)

In article <1991Jan15.102423.12793@watmath.waterloo.edu> datangua@watmath.waterloo.edu (David Tanguay) writes:
>I've been using our compiler's #pragma warning "string" directive lately ...
>It's much less ignorable than
>	/* someday we should renooberate the frozbit */

There are some problems with this.  The main one is that it only works
for one particular compiler implementation, so you may have to go through
the code and fix these when porting to another platform.

We use /* XXX -- someday we should renooberate the frozbit */ comments
instead; this stands out pretty darn well when editing the code and it's
easy to grep for all XXX comments.  Also, it doesn't keep blathering
every time the code is compiled.