RE: [Boost-users] lexical_cast causes level 4 warnings w/ VC7.1

Peter Dimov mailto:pdimov@mmltd.net wrote:
Sam Partington wrote:
4511 and 4512 are useless warnings. They are telling you that the copy constructor and assignment operator are inaccessible. Even though you're not trying to call them. [...]
C4127 is also awkward. As it gives warnings for some common idioms. It refers to conditional expressions being constant.
These warnings can be annoying, but they aren't useless. They do find bugs.
I agree that 4127 can help you find bugs. But I can't think of any situation where 4511 or 4512 will help you find a bug. If you actually try to call an inaccesible copy constructor or assignement operator, then the compiler (correctly) fails to compile it. Thats why I used the word "awkward" rather than "useless" for 4127. I'll happily be proved wrong though. Sam ****************** This e-mail has been sent from Imagination Technologies Limited. PowerVR, Metagence, Ensigma and PURE Digital are divisions of Imagination Technologies Limited. The information contained in this e-mail, including any attachment, is confidential and may be legally privileged. It is intended solely for the addressee(s) and access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying or distribution or use of the information contained in this e-mail, is prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender by return e-mail and then delete it from your system. Internet communications cannot be guaranteed to be secure, error or virus-free. The sender does not accept liability for any errors or omissions which arise as a result. Any views expressed in this message are those of the author, except where the author specifies and, with authority, states them to be the views of Imagination Technologies Ltd.

Peter Dimov mailto:pdimov@mmltd.net wrote:
Sam Partington wrote:
4511 and 4512 are useless warnings. They are telling you that the copy constructor and assignment operator are inaccessible. Even though you're not trying to call them. [...]
C4127 is also awkward. As it gives warnings for some common idioms. It refers to conditional expressions being constant.
These warnings can be annoying, but they aren't useless. They do find bugs.
I agree that 4127 can help you find bugs. But I can't think of any situation where 4511 or 4512 will help you find a bug. If you actually
Sam Partington wrote: try
to call an inaccesible copy constructor or assignement operator, then the compiler (correctly) fails to compile it.
Thats why I used the word "awkward" rather than "useless" for 4127.
I'll happily be proved wrong though.
I can't recall a specific example at the moment, though I have definitely encountered one several times. The basic idea is that 4511/4512 help you enforce the guideline that a class should always either have a declared copy constructor and an assignment operator, or a comment that says "implicit versions are fine and useful". This guideline _does_ eliminate bugs by forcing programmers to think clearly about the copy semantics of every class that they write. With this in mind, every 4511/4512 indicates a violation of this guideline (because the implicit versions are obviously neither fine nor useful), and many violations are bugs ( the guideline would be useless if this weren't so ;-) ). This guideline is not universally accepted. Some prefer the ": noncopyable" idiom, or some equivalent thereof. If you don't buy it, you will likely find 451[12] useless. Your choice.
participants (2)
-
Peter Dimov
-
Sam Partington