|
Boost : |
Subject: Re: [boost] suggestion on assertion macros
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-03-12 13:50:05
Roland Bock wrote:
> Steven Watanabe wrote:
> >
> > MSVC 9.0 /W4
> >
> > .\scratch.cpp(14) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
> > .\scratch.cpp(14) : warning C4127: conditional expression is constant
> > .\scratch.cpp(7) : warning C4505: 'assert_helper' : unreferenced local function has been removed
> >
> OK, seems I need a sterner compiler.
s/sterner/noisier/?
C4800 seems ridiculous. Writing code using int as a Boolean is common to C code. Why would VC 9 inflict useless noise when compiling such code? Besides, if the variable is int, and it is needed in a Boolean context, what else would the developer do? I've seen use of the conditional operator to avoid that warning. I suspect that produces worse code than what is done when "forcing value to bool 'true' or 'false'."
C4505 seems useless. Why would one need to know that unused code isn't included in the object code? Either it is used and will cause a link error or it isn't and its absence isn't important. Did I miss a case?
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk