1833043 Members
2852 Online
110049 Solutions
New Discussion

LP64 migration warning

 
SOLVED
Go to solution
FrankAtWork
Occasional Contributor

LP64 migration warning

When compiling the source-code line:
if ( strncmp( LV.zustand_dialog, "PF", 2 ) )

i get the compiler warning:
LP64 migration warning 753: Argument #3 converts 32 bit integer to long

What can i do against it ?

Many thanks in advance

3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor

Re: LP64 migration warning

Cast the constant 2 to the expected type. ie 2 ==> (size_t) 2.
If it ain't broke, I can fix that.
FrankAtWork
Occasional Contributor

Re: LP64 migration warning

Now i get:
LP64 migration warning 753: Cast converts 32 bit integer to long

..
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: LP64 migration warning

Okay, your are probably compiling with the options +DD64 and +M2. You can reduce to +M1. Under the +DD64 (or DA2.0W) models integers (and integer constants) are 32 bits while pointers, longs, and size_t's (the type of the 3rd argument in strncmp) are 64-bits.

If you want to "outbushwhack" the warning completely then
(size_t) 2L BUT you now set yourself up for the reverse potential problem if your are running +DD32. However, since +M2 requires +DD64 to be asserted, you don't get the warning for the inverse case. In any event, these are warnings only just that and the actual type conversions in either direction work and the size_t cast forces the correct behavior.

(size_t) 2L will take care of the warning.
If it ain't broke, I can fix that.