Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!rutgers!att!cbnews!cblpf!mark From: mark@cblpf.ATT.COM (Mark Horton) Newsgroups: comp.std.c Subject: Re: Volatile (was Re: observability) Message-ID: <9541@cbnews.ATT.COM> Date: 14 Sep 89 15:50:57 GMT References: <28993@news.Think.COM> <7330001@hpfcso.HP.COM> Sender: nntp@cbnews.ATT.COM Reply-To: mark@cblpf.ATT.COM (Mark Horton) Organization: AT&T Bell Laboratories, Columbus Lines: 31 P E Smee writes: > >one might ask why you would want to write a chunk > >of code that has ZERO effect. > I sometimes do this during program development. I declare the data > structures and write the code that operates on them, leaving the i/o > to worry about later. I may want to compile at this point to check > for errors in the code. If all you want is syntax and semantic checking, you're going to get that unless the code is surrounded by something like #ifdef notdef (useless code) #endif /* notdef */ which the compiler had better ignore - it might contain comments. (I hope pANS hasn't outlawed making comments this way and otherwise neutralizing old code that you might want again someday.) For the compiler to determine that a particular piece of code is useless, it has to perform a fair amount of analysis. It has to process the preprocessor, syntax, semantics, generate code, and do some kind of analysis. A syntax error will certainly be detected and reported, as will a static semantic error. Runtime errors are going to be hard to detect without I/O statements, unless the thing divides by zero or something without any I/O. I don't see how any "useless code deletion" feature is going to get in your way. It can't determine that the code is useless without understanding it. Of course, you could always just use a syntax directed editor. Mark