Topic: #warning would be nice
Author: pedwards@cs.wright.TOAST.edu (Phil Edwards)
Date: 1997/09/02 Raw View
+ >> #warning "This stub is NOT READY TO SHIP!"
FWIW, many of the compilers (preprocessors) that I use support this idea
in a roundabout fashion: while the #warning itself is not processed,
they complain anyway:
[4 gamma]> cxx -w0 p.C
cxx: Warning: p.C, line 5: "warning" is an invalid preprocessor
directive, and is being ignored.
#warning This code is a piece of crap.
-^
[5 gamma]>
And so the original effect is achieved anyhow, since compilation
is not halted by the preprocessor's bitching-and-moaning. :-)
Luck++;
/dev/phil
=> Incoming mail has reached unacceptable levels of spam/day; my address
has been munged as a result. Remove the TOAST (duh) and mail away!
=> If you post a followup, please don't email a copy to me. I read news
often enough that replying to things twice is annoying. But thanks.
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: rdamon@BeltronicsInspection.com (Richard Damon)
Date: 1997/09/02 Raw View
Valentin Bonnard <bonnardv@pratique.fr> wrote:
>Richard Damon <rdamon@BeltronicsInspection.com> writes:
>
>> Valentin Bonnard <bonnardv@pratique.fr> wrote:
>
>> >This is interresting but a #pragma seems to fit; I would
>> >like to see std pragma (they need not to be defined, but
>> >can only mean something):
>> >
>> >#pragma once // multiple inclusions are ignored
>> >#pragma warning "text" // warns that 'text'
>>
>> I would prefer that if these are standardized that it *not* be as a
>> #pragma. This leaves #pragma as a flag that this is a implementation
>> defined feature to be looked at carefully when porting. It also allows the
>> implementer to not worry about having a #pragma they have defined being
>> taken by the standard.
>
>And to leave the user worrying that the #pragma might have annother
>meaning on annother implementation (not just no meaning).
>
>It means: all efforts are made by the user, none by the implementor;
>Ada has some std pragma, I think C++ could have some too.
I am not against adding a new preprocessor command like #warning "text". I would
have problems with defining what #pragma warning means as this was given to the
implementer. In particular one of he compilers I use defines it very
differently. It uses #pragma warning to control what warnings to print out, I
would hate to have to find all of these and change them. I work under the rule
that the program must compile cleanly under maximum warning level before
release. I use the #pragma warning, with documentation on why it is needed, if
the code can not be made warning clean any other way. And it is needed as the
compiler will give warnings on valid code, as is allowed. It is important to
silence the warnings so we can see any unexpected messages.
I do not see this a making life easier on implementors, but on uses who are
using an extension provided by their implementer which was built according to
the standard.
Perhaps there should be a "#option xxxx" statement with defined meanings which
can be implemented or not, for things that would want to be you standard
#pragma.
--
richard_damon@iname.com (Redirector to my current best Mailbox)
rdamon@beltronicsInspection.com (Work Adddress)
rdamon@sprynet.com (Personal Address)
Richad_Damon@msn.com (Just for Fun)
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1997/08/25 Raw View
Larry Brasfield <SpamGuard-larrybr@sqi.com> writes:
> (This idea is, of course, directed toward whatever
> thinking is going into C+=2, not C++.)
>
> For development purposes, it would be convenient to
> have a standardized way of generating warnings with
> specific messages at compile time. Several compilers
> now do this by issuing warnings against lines such as:
>
> #warning "This stub is NOT READY TO SHIP!"
This is interresting but a #pragma seems to fit; I would
like to see std pragma (they need not to be defined, but
can only mean something):
#pragma once // multiple inclusions are ignored
#pragma warning "text" // warns that 'text'
--
Valentin Bonnard
mailto:bonnardv@pratique.fr
http://www.pratique.fr/~bonnardv (Informations sur le C++ en Francais)
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: rdamon@BeltronicsInspection.com (Richard Damon)
Date: 1997/08/28 Raw View
Valentin Bonnard <bonnardv@pratique.fr> wrote:
>Larry Brasfield <SpamGuard-larrybr@sqi.com> writes:
>
...
>> #warning "This stub is NOT READY TO SHIP!"
>
>This is interresting but a #pragma seems to fit; I would
>like to see std pragma (they need not to be defined, but
>can only mean something):
>
>#pragma once // multiple inclusions are ignored
>#pragma warning "text" // warns that 'text'
I would prefer that if these are standardized that it *not* be as a #pragma.
This leaves #pragma as a flag that this is a implementation defined feature to
be looked at carefully when porting. It also allows the implementer to not worry
about having a #pragma they have defined being taken by the standard. For
example what if I wanted my compiler to have a variation on the warning like
this:
#pragma warning level "text"
which allowed be to conditionally display the warning based on the warning level
set in the compiler.
--
richard_damon@iname.com (Redirector to my current best Mailbox)
rdamon@beltronicsInspection.com (Work Adddress)
rdamon@sprynet.com (Personal Address)
Richad_Damon@msn.com (Just for Fun)
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Larry Brasfield <SpamGuard-larrybr@sqi.com>
Date: 1997/08/21 Raw View
(This idea is, of course, directed toward whatever
thinking is going into C+=2, not C++.)
For development purposes, it would be convenient to
have a standardized way of generating warnings with
specific messages at compile time. Several compilers
now do this by issuing warnings against lines such as:
#warning "This stub is NOT READY TO SHIP!"
Here are reasons this should be standardized:
1. It is often desirable to create code that enables
program build and execution to proceed but which is
in need of further attention.
2. Other methods of marking code for this purpose
require extra processing outside of the normal
build process, requiring extra work and setup.
3. Methods relying upon particular comment text
("// TODO:", "//UNDONE:", etc) are prone to failure
due to typo's. ("// TODo:") The marking method
must be reliable to be effective.
4. The #warning method fits naturally into standard
development conventions whereby compiler warnings
are dissallowed at various stages.
5. The convention is already partially established.
6. It should be easy to implement since it closely
resembles the existing #error directive.
--
--Larry
work: (425)557-1670 larrybr@sqi.com
home: (206)236-2121 larrybr@earthlink.net
Aforementioned views are likely mine alone.
(Remove SpamGuard- for an email reply.)
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1997/08/31 Raw View
Richard Damon <rdamon@BeltronicsInspection.com> writes:
> Valentin Bonnard <bonnardv@pratique.fr> wrote:
> >This is interresting but a #pragma seems to fit; I would
> >like to see std pragma (they need not to be defined, but
> >can only mean something):
> >
> >#pragma once // multiple inclusions are ignored
> >#pragma warning "text" // warns that 'text'
>
> I would prefer that if these are standardized that it *not* be as a
> #pragma. This leaves #pragma as a flag that this is a implementation
> defined feature to be looked at carefully when porting. It also allows the
> implementer to not worry about having a #pragma they have defined being
> taken by the standard.
And to leave the user worrying that the #pragma might have annother
meaning on annother implementation (not just no meaning).
It means: all efforts are made by the user, none by the implementor;
Ada has some std pragma, I think C++ could have some too.
--
Valentin Bonnard
mailto:bonnardv@pratique.fr
http://www.pratique.fr/~bonnardv (Informations sur le C++ en Francais)
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]