Operating System - HP-UX
1829208 Members
2598 Online
109987 Solutions
New Discussion

Re: Why if putting <limits> and <string> together could cause warnings?

 
modemer
New Member

Why if putting <limits> and <string> together could cause warnings?

$ uname -a
HP-UX mildev01 B.11.23 U 9000/800

$ cat a.C
#include
#include
int i;

Compile(64bit build):
$ aCC -AA -Aa +DD64 +M2 -c a.C
Warning (suggestion) 818: "/opt/aCC/include_std/limits", line 681 # Type 'long' is larger than type 'wchar_t', truncation in value may result.
_RWSTD_SPECIALIZE_LIMITS (wchar_t, _RWSTD_INT_CONVERTIBLE, _RWST
^^^^^^^^^^^^^^^^^^^^^^^^
Warning (suggestion) 818: "/opt/aCC/include_std/limits", line 681 # Type 'unsigned long' is larger than type 'wchar_t', truncation in value may result.
_RWSTD_SPECIALIZE_LIMITS (wchar_t, _RWSTD_INT_CONVERTIBLE, _RWST
^^^^^^^^^^^^^^^^^^^^^^^^

If remove or from the file, the warning won't come out.

Anyone could explain the reason? How to solve their conflict?(I need both in the file)


Thanks,

Peter
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: Why if putting <limits> and <string> together could cause warnings?

Shalom Peter,

Either you have code that conflicts with the haaders, or the headers are out of date and need replacement.

Or perhaps both.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
modemer
New Member

Re: Why if putting <limits> and <string> together could cause warnings?

Steve, thanks for your reply.

You should see my code has just 3 lines. It shouldn't cause the conflict.

As for the system files, we are using HP supported versions and patches.

$ uname -a
HP-UX mildev01 B.11.23 U 9000/800
$ aCC -V
aCC: HP ANSI C++ B3910B A.03.65

It's better to test with my example code in your environment if you have same version OS and aCC.
Hein van den Heuvel
Honored Contributor

Re: Why if putting <limits> and <string> together could cause warnings?

Sounds like a very basic incompatibiltiy.
Check the dates on those include files: was either replaced?

Have you tried swapping those two include lines?

Try to include limits.h before string.h?

fwiw...
limits.h is documented in section-5 'limits'

http://docs.hp.com/en/B2355-90847docs/B2355-90847docs.pdf

Hein.