Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Sat, 13 Aug 2011 02:14:50 -0500 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: is there anything unstandard in the c part here References: <996dhnFhnlU1@mid.individual.net> <6e8108d6-cf53-4d7c-940d-8a0dcad1315b@y24g2000yqb.googlegroups.com> <8ef48d47-7fd0-4afa-82ab-10aced7b8e3f@df3g2000vbb.googlegroups.com> <87y5zce4mc.fsf@gmail.com> Date: Sat, 13 Aug 2011 08:14:50 +0100 Message-ID: <87k4ahbx5h.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:M3uzl6baa+dj94J2FQSb5WDSx00= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 39 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-4ueHo+SZW2Zh0OK20z7K+Q08PSWm3NEs2z7/B/M6fyqCbRe3XdiI/YT5MLJoZxacBIaXiFhNFCFSOYi!jpMsxL0ETWneEjRQr6vES3El8hv7IZEJQKuuIdyANaKGcoWJAZAFh5QFipbKPJuvhaAbqQ== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2639 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:9330 James Kuyper writes: > Being more direct won't help. He's been repeatedly asked to provide an > example, and so far the only bug he's presented would have remained a > bug, and remained hidden, even after the cast was "corrected", so it was > clearly not the cast which was hiding the bug. Stop being a dick, James. The bug becomes a compile time error. float * foo; // elision foo = (float*) malloc(256*sizeof(float)); becomes double * foo; foo = (float*) malloc(256*sizeof(float)); Compile time error. Do you really think someone would fix that compile time error by changing *JUST THE CAST*? foo = (float*) malloc(256*sizeof(float)); foo = (double*) malloc(256*sizeof(float)); "Ohh, the bug is still there." Yes it is, because you've sent a moron to fix it, who doesn't look at the context of the code, and who thinks type safety is just fixing casts and hoping for the best. Do you really believe that's how to use the idiom for defensive programming? Nice strawman. The point is, the cast is working as a static assertion, flagging the assumption made within size calculation. The fix is not to change the assertion until you've changed the calculation. double * foo; // elision foo = malloc(256*sizeof(float)); Nasal demons.