- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- C Compile Warning on HP-UX 11.31 64-bit Itanium sy...
Operating System - HP-UX
1755383
Members
3428
Online
807
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2010 11:56 AM
тАО08-03-2010 11:56 AM
I am getting the warning below when I try to compile a C program on an HP-UX 11.31 64-bit Itanium system. Why am I getting this warning and how do I resolve the problem?
Thanks
cc -Ae -DHPUX -DORAIA64 -DHPUX_IA64 +DD64 -DSS_64B -I /u01/app/oracle/p
roduct/11.2.0/db_1/precomp/public /u01/app/oracle/product/11.2.0/db_1/rdbms/lib
/u01/app/oracle/product/11.2.0/db_1/precomp/public/ -c DRMSSLogging.c
"DRMSSLogging.c", line 335: warning #2181-D: argument is incompatible with corre
sponding format string conversion
sprintf(SecsStr, "%d", tp.tv_usec);
Thanks
cc -Ae -DHPUX -DORAIA64 -DHPUX_IA64 +DD64 -DSS_64B -I /u01/app/oracle/p
roduct/11.2.0/db_1/precomp/public /u01/app/oracle/product/11.2.0/db_1/rdbms/lib
/u01/app/oracle/product/11.2.0/db_1/precomp/public/ -c DRMSSLogging.c
"DRMSSLogging.c", line 335: warning #2181-D: argument is incompatible with corre
sponding format string conversion
sprintf(SecsStr, "%d", tp.tv_usec);
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2010 12:25 PM
тАО08-03-2010 12:25 PM
Solution
Because tv_usec is defined as a long, if I'm reading /usr/include/sys/_timeval.h correctly. (It is a long if _INCLUDE_XOPEN_SOURCE_PRE_500 is defined, and a suseconds_t otherwise... which is just a typedef'd long anyway).
So when you compile 64-bit and use %d you're trying to print a long as an int and the compiler is properly warning you that this isn't compatible. Rather, this should be:
sprintf(SecsStr, "%ld", tp.tv_usec);
So when you compile 64-bit and use %d you're trying to print a long as an int and the compiler is properly warning you that this isn't compatible. Rather, this should be:
sprintf(SecsStr, "%ld", tp.tv_usec);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2010 10:18 PM
тАО08-03-2010 10:18 PM
Re: C Compile Warning on HP-UX 11.31 64-bit Itanium system
The aCC6 compiler does format cracking and makes sure your format matches your data types.
It checks sizes and types and whether a format is missing or extra.
It checks sizes and types and whether a format is missing or extra.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2010 04:29 AM
тАО08-04-2010 04:29 AM
Re: C Compile Warning on HP-UX 11.31 64-bit Itanium system
Thank you for the responses.
Changing from:
sprintf(SecsStr, "%d", tp.tv_usec);
To
sprintf(SecsStr, "%ld", tp.tv_usec);
resolved the warning.
Curtis
Changing from:
sprintf(SecsStr, "%d", tp.tv_usec);
To
sprintf(SecsStr, "%ld", tp.tv_usec);
resolved the warning.
Curtis
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP