Operating System - HP-UX
1828859 Members
2568 Online
109985 Solutions
New Discussion

Addition of pointers and int

 
BALAJI CHANDRAN
Occasional Contributor

Addition of pointers and int

Hi,

While adding the char * variable with the integer variable i am getting following warning in HP-UX 11i

LP64 migration warning 733: + between pointer and 32 bit integer

But i am not getting it in HP-UX11.0

please clarify

Regards
Balaji


2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor

Re: Addition of pointers and int

Well, different versions of compiler do different things but a more important point is why you would not want to warned about such a very questionable construct? You always have the option od adding the +W733 flag to the compiuler to suppress the warning.

This kind of operation almost always leads to non-portable code and that is what you are being warned about. You could (and should always have been) using a cast to tell the compiler that you really want to do this and then the warning should be suppressed.
If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: Addition of pointers and int

>LP64 migration warning 733: + between pointer and 32 bit integer

 

There should be nothing wrong to add a 32 bit int (or even smaller) to a pointer.  The problem would occur if you are trying to store the result in a 32 bit integer.