M
Marc Ferry
I already posted this mail in comp.sys.hp and comp.sys.hp.hpux but had
no response. As this problem might be present on other OSes than HP-UX
10.20, I crosspost it here, in the hope of getting an answer.
*************************
In C/C++ system include files on HP-UX 10.20,
/usr/include/values.h defines macro MAXINT as (~HIBITI)
/usr/include/sys/param.h defines macro MAXINT as 0x7fffffff
Why is that so ?
I understand that the final value is the same.
But as my program happens to include both values.h and param.h, I get
the following error (future) with aCC:
Error (future) 129: "/usr/include/values.h", line 27 # Redefinition of
macro 'MAXINT' differs from previous definition
at ["/usr/include/sys/param.h", line 45].
#define MAXINT (~HIBITI)
^^^^^^
Warning: 1 future errors were detected and ignored. Add a '+p'
option to detect and fix them before they become fatal errors in a
future release. Behavior of this ill-formed program is not guaranteed to
match that of a well-formed program
I cannot change the libraries (which include values.h and param.h) used
by my program because I don't own them. I don't want to use compile
option +W129 because it would suppress this particular future error but
also all the others.
Is there a simple trick to avoid this error ?
I noticed that the problem has been fixed on HP-UX 11i. Indeed, values.h
defines MAXINT only if it is not already defined:
#ifndef MAXINT
#define MAXINT ((int)(~(unsigned int)HIBITI))
#endif /** MAXINT **/
Thanks for your advice.
Marc Ferry
no response. As this problem might be present on other OSes than HP-UX
10.20, I crosspost it here, in the hope of getting an answer.
*************************
In C/C++ system include files on HP-UX 10.20,
/usr/include/values.h defines macro MAXINT as (~HIBITI)
/usr/include/sys/param.h defines macro MAXINT as 0x7fffffff
Why is that so ?
I understand that the final value is the same.
But as my program happens to include both values.h and param.h, I get
the following error (future) with aCC:
Error (future) 129: "/usr/include/values.h", line 27 # Redefinition of
macro 'MAXINT' differs from previous definition
at ["/usr/include/sys/param.h", line 45].
#define MAXINT (~HIBITI)
^^^^^^
Warning: 1 future errors were detected and ignored. Add a '+p'
option to detect and fix them before they become fatal errors in a
future release. Behavior of this ill-formed program is not guaranteed to
match that of a well-formed program
I cannot change the libraries (which include values.h and param.h) used
by my program because I don't own them. I don't want to use compile
option +W129 because it would suppress this particular future error but
also all the others.
Is there a simple trick to avoid this error ?
I noticed that the problem has been fixed on HP-UX 11i. Indeed, values.h
defines MAXINT only if it is not already defined:
#ifndef MAXINT
#define MAXINT ((int)(~(unsigned int)HIBITI))
#endif /** MAXINT **/
Thanks for your advice.
Marc Ferry