HP OpenVMS Systemsask the wizard |
The Question is:
I would like to know how one instructs the
OpenVMS C++ compiler to issue messages about
questionable code.
For instance, consider the following code:
----------------------------------------------
extern int important(void);
void sloppy(void) {
important();
-----------------------------------------------
Here I would like the compiler to warn me
that I have forgotten to use the return
value of the important() function.
If I compile this with
'cc'
I get no warnings.
If I compile this with
'cc /warn=(enable=all)'
I get a "warning" %CC-I-IGNORECALLVAL.
This is fine.
If I compile this with
'cxx'
I get no warning
If I compile this with
'cxx /warn=(enable=all)'
I still get no warning. This is a bit of
a dissappointment.
If I compile this with
'cxx /warn=(enable=IGNORECALLVAL'
the C++ compiler informs me that it does not
know anything about ident=IGNORECALLVAL and
still gives me no warning.
According to the documentation for cxx /warn
qualifer one should be able to write
/warn=(enable=all)
or
/warn=(enable=(ident,ident...))
However, the documentation is a bit vague
about the meaning of enable=all and also
about what 'ident' can be. The C compiler
accepts individual message identifiers as
well as message categories as ident.
If my understandinng of the C++ documentation
is correct there are no message catagories
for C++ - only individual messages can be
substituted for 'ident' on the C++ command
line. Is this correct?
I have also been unable to find a C++ manual
that lists the messages emitted by the
compiler so I don't know which values can
be legally substituted for ident.
Where can I find information about values that
can be substituted for 'ident' in the cxx
/warn qualifer?
Specifically, how do I instruct the C++ compiler
to warn me about:
1) Ignored return values
2) Un-used variables
3) Use of un-initialized variables.
I have no problem in instructing the C compiler
to do this - its documentation is quite clear.
Unfortunately the C++ compiler documentation
is not all as clear.
I am using the following compiler versions:
------------------------------------------
$ cc /version
Compaq C V6.5-001 on OpenVMS Alpha V7.3
$ cxx /version
Compaq C++ V6.5-004 for OpenVMS Alpha V7.3
------------------------------------------
Thanks,
Lars
The Answer is : C has this capability, while C++ presently does not.
|