Article View: comp.std.c++
Article #2682Re: an optimization I claim is illegal
From: David Chase
Date: Tue, 21 Nov 1995 03:06
Date: Tue, 21 Nov 1995 03:06
31 lines
2098 bytes
2098 bytes
Though I think the programming practices that make the optimization illegal are relatively vile (*), I think it is a mistake to argue the point in terms of 486 assembly language. Furthermore, the situation described > This machine code may LOOK OK, but it ISNT. Why? Because an > interrupt may come flying in after the call to f and before the > return. The machine registers are pushed onto the stack > in the interrupt. After the interrupt has done its job > it pops the register back. WOOPS!!! A segment register > gets loaded with an invalid address. A general protection > fault ensues. sounds odd to me -- to me, this sounds like quality of OS implementation, not standards stuff (why would an interrupt handler fail to put the registers back? Is this some DOS thing?). I'd be interested to see just how this could be disallowed without banning other things that people find useful and not so vile. It-would-be-nice, from a taste point of view, if whatever prohibition emerges could be checked at compile-time, though I suppose my employer would be perfectly happy if the bug could only (practically) be detected by running the code through a debugging interpeter. (*) Relative, of course, to what I already think of C++ code in general. speaking for myself, David Chase --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<48r0b9$d07@wcap.centerline.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<48ngom$r5f@oznet07.ozemail.com.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 21 Nov 95 03:06:55 GMT Approved: fjh@cs.mu.oz.au From: chase@centerline.com (David Chase) Newsgroups: comp.std.c++ Subject: Re: an optimization I claim is illegal X-Original-Date: 20 Nov 1995 22:43:53 GMT Organization: CenterLine Software Message-ID: <48r0b9$d07@wcap.centerline.com> References: <48ngom$r5f@oznet07.ozemail.com.au> Reply-To: chase@centerline.com X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMLFCY+EDnX0m9pzZAQFzbwF/UIUumtzPqLdHiyrPpDfdcEVuznCZxdn5 htQOzo9j0K8pcEv1j6jn/10MXjoA7QvR =idet