473,789 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is MAXINT doubly defined in system include files

I already posted this mail in comp.sys.hp and comp.sys.hp.hpu x 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)(~(unsign ed int)HIBITI))
#endif /** MAXINT **/

Thanks for your advice.
Marc Ferry

Nov 13 '05
11 20907
On Mon, 13 Oct 2003 15:26:05 +0200, Marc Ferry
<mf********@rd. francetelecom.c om> wrote:
tom_usenet wrote:
<mf********@rd. francetelecom.c om> wrote:
I already posted this mail in comp.sys.hp and comp.sys.hp.hpu x 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.


This newsgroup is for issues relating to ISO standard C++ (or C for
the crosspost). This clearly isn't the right place,
comp.unix.progr ammer would be slighly closer. But if you can't get an
answer on HP related newsgroups, you should contact HP directly, since
there's no where else to post such questions.


Don't you mix up with comp.std.c++ ?


Nope: http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Presumably a bug. Have you asked HP?


Not yet. I am going to look for my support contract with HP (if I have one).

Thanks for your advice.


Either you're going to have to edit the system headers yourself, or
you're going to have to edit the 3rd party library, or you're going to
have to get a patch from HP to fix the system headers for you. The 3rd
option sounds best to me...

Tom
Nov 13 '05 #11
On Mon, 13 Oct 2003 15:22:14 +0200, Marc Ferry
<mf********@rd. francetelecom.c om> wrote:
Nick Austin wrote:
<mf********@rd. francetelecom.c om> wrote:
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
#include <values.h>
#undef MAXINT
#include <sys/param.h>


Question: Where should I put these lines ?


In the files that include <values.h> and <param.h>.

If you cannot modify either of these files then the process needs
to be applied recursively; so if <foo.h> contains #include <values.h>
then find the file that contains #include <foo.h> and include the
#undef there.
Remember: I cannot change the includes done by the libraries because I
don't own them (external product). And I doubt that both values.h and
param.h includes are in the same library.


This highlights a design issue.

When designing and implementing header files for a third party you
need rules to avoid namespace clashes. If this is not possible an
alternative is to split the application into translation units.
Each translation unit is designed so that it only needs to include
definitions from one set of header files.

Nick.

Nov 13 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1315
by: Bengt Richter | last post by:
Peculiar boundary cases: >>> 2.0**31-1.0 2147483647.0 >>> int(2147483647.0) 2147483647L >>> int(2147483647L ) 2147483647 >>> >>> -2.0**31
6
2091
by: Bengt Richter | last post by:
Peculiar boundary cases: >>> 2.0**31-1.0 2147483647.0 >>> int(2147483647.0) 2147483647L >>> int(2147483647L ) 2147483647 >>> >>> -2.0**31
11
12484
by: Marc Ferry | last post by:
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
4
2932
by: dssuresh6 | last post by:
Whether browsing forward or backward can be done using a singly linked list. Is there any specific case where a doubly linked list is needed? For people who say that singly linked list allows traversal only in one direction, I would say that using appropriate loops/recursion, traversal in opposite direction is also possible. Then why the need for doubly linked list? --
8
4170
by: sudhirlko2001 | last post by:
How to swap two nodes of doubly Linklist
0
7797
by: Scott Chang | last post by:
Hi all, I have Microsoft Visual C++ .NET (2002) program that is installed on my Windows XP Professional Operating System PC. I started my project (named HelloMCPP)in the Managed C++ Application and added a DLL in the .h file to my project for printing "Hello from Managed C++!" out in my console. I did "Build" the program 'HelloMCPP' and I got 'Fatal Error LNK1561: entry point must be defined HelloMCPP'. I do not know how to define the...
6
2064
by: Sebastian Schack | last post by:
Hey everyone. Hope I'm in the right spot here... if not, please correct me. My .css starts with the definition of the body-part which looks as follows: body { background: #FFFFFF url(images/banner_spacer.png) repeat-x; font: normal small Arial, Helvetica, sans-serif; }
4
3093
kim6987
by: kim6987 | last post by:
can you please spend a little time evaluating this code. I can not run it successfully thanks :) #include<stdio.h> #include<conio.h> #include<stdlib.h> #define SIZE 10 typedef struct dlist
1
2353
by: Mahesh | last post by:
Hi Coders, I was asked to write a program to interchange numbers using doubly linked list @ Amazon. Here is the details with Code that i wrote. i/p: 1 2 3 4 5 6 7 8 .....n,n-1. o/p: 2 1 4 3 6 5 8 7.....n,n-1.
13
2089
by: Ruud | last post by:
Hallo allemaal, This is my first message to this group. Until now I mainly wrote programs in Turbo Pascal. But now I'm involved in a project were knowledge of C is needed. I'm not unfamiliar with C, but the last time I used it was maybe 8 years ago. I wrote quite some programs in TP and one goal is to translate them into C. In time I created some common, so called, units. I already
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.