O
ozbear
In one of the C compilers I use if I declare a static variable
in a translation unit thus:
static short x;
to which there is no subsquent references to x anywhere within the
translation unit, I receive a warning stating that there are no
references to x. That is fine, I realise that the compiler is
free to issue whatever warning messages it pleases.
However, the compiler also suppresses generation of x's "space"
in the resulting executable.
Is this permitted by the Standard (89 or 99)?
Placing a
static char[] version = "version 1.2";
is useful when looking at a dump of a file to see what the version
string has in it, but if this information is suppressed from the
executable because there is no reference to the static var
/version/ then I have to resort to crude means to create an
"artificial" reference to /version/.
Is my compiler broken?
Oz
in a translation unit thus:
static short x;
to which there is no subsquent references to x anywhere within the
translation unit, I receive a warning stating that there are no
references to x. That is fine, I realise that the compiler is
free to issue whatever warning messages it pleases.
However, the compiler also suppresses generation of x's "space"
in the resulting executable.
Is this permitted by the Standard (89 or 99)?
Placing a
static char[] version = "version 1.2";
is useful when looking at a dump of a file to see what the version
string has in it, but if this information is suppressed from the
executable because there is no reference to the static var
/version/ then I have to resort to crude means to create an
"artificial" reference to /version/.
Is my compiler broken?
Oz