home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!UB.com!igor!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Newsgroups: comp.lang.c++
- Subject: Re: Destruction of temporaries
- Message-ID: <rmartin.715445565@thor>
- Date: 2 Sep 92 14:52:45 GMT
- References: <rmartin.715101472@thor> <1992Aug31.162915.2577@Warren.MENTORG.COM> <rmartin.715356168@thor> <1992Sep1.154828.687@Warren.MENTORG.COM>
- Sender: news@Rational.COM
- Lines: 39
-
- adk@Warren.MENTORG.COM (Ajay Kamdar) writes:
-
- |In article <rmartin.715356168@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
- |>adk@Warren.MENTORG.COM (Ajay Kamdar) writes:
- |>
-
- | - example where implicit conversion of a temporary to char* is ok deleted -
-
- |>|I wouldn't want the compiler to issue warnings in such a case, irrespective
- |>|of whether operator char*() was called on a temporary or not.
- |>
- |>Then, you should cajole your compiler vender into supplying you with a
- |>compiler which provides you with the type of #pragma control that lets
- |>you supress the warnings on a function by function basis.
-
- |[...] But if it is a language standard that you are advocating, then
- |depending upon pragmas (which are implementation dependent by
- |definition) to silence warnings from code which is perfectly ok seems
- |inappropriate to me. If the standard specifies the generation of
- |warnings, it had better make sure that it enables the compilers to
- |generate warnings only for the problematic cases and not for good
- |code.
-
- |Warning about conversion of a temporary to pointer or reference is a nice
- |goal to shoot for, but that needs the language to be enhanced to enable
- |the compilers to do a good job of it.
-
- Unfortunately, in the absence of a foolproof mechanisms for deletion
- of temporaries, the warnings are the only defence you have against the
- creation of long lived pointers or references to dead temporaries...
- Ugly as spurious warnings are, silent errors are much worse. (IMHO).
-
-
-
- --
- Robert Martin Training courses offered in:
- R. C. M. Consulting Object Oriented Analysis
- 2080 Cranbrook Rd. Object Oriented Design
- Green Oaks, Il 60048 (708) 918-1004 C++
-