Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!dali.cs.montana.edu!milton!sumax!quick!dsinet!davidk From: davidk@dsinet (David Karr) Newsgroups: comp.unix.programmer Subject: Optimizing out unreferenced variables Message-ID: <608@elroy> Date: 7 May 91 00:03:01 GMT Organization: Digital Systems Intl., Inc. Lines: 17 I have been hearing about a tendency for certain Unix optimizing C compilers to deal harshly with static variables declared in C modules that are not referenced in that module. In other words, it will delete those variables from the object file. A controversial example would be variables declared in each module to hold RCS or SCCS information. Often these variables will be declared as static, and only used by certain utilities to parse out the version numbers from an executable binary. I was told that the C compiler on AIX has this particular "affliction". Is this a general feature of optimizing C compilers, and will more compilers be adding this "feature" as time goes on, or is the AIX compiler a fluke? I heard a mention that the HP 700 compiler would be doing this in the future. -- Digital Systems International, Inc. David Karr 7730 177th Pl NE dsinet!davidk Redmond, WA 98073-0903 (206) 881-7544 ext. 547