Optimizing out unreferenced variables
David Karr
davidk at dsinet
Tue May 7 10:03:01 AEST 1991
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
More information about the Comp.unix.programmer
mailing list