Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!sun!amdcad!BitBlocks.COM!bvs From: bvs@BitBlocks.COM (Bakul Shah) Newsgroups: comp.object Subject: Re: C as a replacement for assembler (Re: Documenting OO Systems) Keywords: volatile Message-ID: <1991Apr9.194126.13457@BitBlocks.COM> Date: 9 Apr 91 19:41:26 GMT References: <1576@acf5.NYU <4o5G2erk1@cs.psu.edu> Organization: Free Ideas Foundation Lines: 30 In <4o5G2erk1@cs.psu.edu> schwartz@groucho.cs.psu.edu (Scott Schwartz) writes: |The problem with compiling to C is that certain things are impossible |to express properly and/or safely. For example, modula 3 has |difficulty with garbage collection when the C compiler's optimizer |decides to rearrange or elide code. This seems like a perfect opportunity for overloading `volatile' -- declare a piece of code volatile to prevent any rearrangement or elision. As in volatile { i = 1; i = 2; j = 3; k = 4; for (i = 0; i < 10; i++) j += 10*k; } The idea is that every variable within a volatile block is treated as if stored in volatile storage (with possible side effects). Now, to make this even more useful one would need `nonvolatile' so that access to selected variables can be optimized even within a volatile block. Nonvolatile also appeals to my sense of symmetry. Has anyone done (or thought of doing) this? Anyway, just an idea for you language designer wannabes. Bakul Shah bvs@bitblocks.com