---------------------------------------- > Date: Mon, 31 Mar 2008 13:51:22 -0700 > From: [EMAIL PROTECTED] > To: [email protected] > Subject: Re: C++0X gets lambdas/closures > > Gabriel Sechan wrote: >>> Date: Mon, 31 Mar 2008 13:00:33 -0700> From: [EMAIL PROTECTED]> To: >>> [email protected]> Subject: Re: C++0X gets lambdas/closures>> >>> Christopher Smith wrote:>> Yeah, 'cause we've been able to come up with a >>> language where the compiler can prove that everything is correct.>> No. I'm >>> simply referring to warnings that are warnings because the> compiler knows >>> you did something wrong and it *will* come back to bite> you, except it >>> doesn't know how you want to fix them. Like "Warning: You> have a virtual >>> methods but no virtual destructor." There's an error in> your code: Either >>> you shouldn't be declaring anything virtual, or you> need the virtual >>> destructor to avoid corrupting memory. Why is this a> warning and not an >>> error?> Because it's not necessarily an error. There are situations where >>> you can have virtual functions yet not need a virtual destructor- whenever >>> you have no dynamic memory in the class. Although personally I declare a >>> destructor virtual for a > nything I expect to have children, its never wrong to do so and can save your > ass... >> Another example of something that should be a warning- size and type >> mismatches. A standard library function returns an unsigned value. I >> compare that to a signed integer. This produces a warning. But 99% of the >> time, it isn't wrong. So a warning and not an error is correct. > > > If 99% of the time the result is correct, does that make the code right > 99% of the time? > >
Rephrasing: 99% of the time, the code in that situation *is* correct. It's only rarely an error. The correct answer is to flag it for human checking, but to allow it, which is what a warning does. Gabe _________________________________________________________________ In a rush? Get real-time answers with Windows Live Messenger. http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_realtime_042008 -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
