- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 32bit and 64 bit pro*c program
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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-19-2004 06:36 PM
тАО08-19-2004 06:36 PM
32bit and 64 bit pro*c program
#include
#include
int main()
{
struct tm *timptr;
int tim;
time(&tim);
timptr=localtime(&tim);
printf("%02d",timptr->tm_mday);
return 1;
}
Can anybody help me please.
Thanks
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2004 07:24 PM
тАО08-19-2004 07:24 PM
Re: 32bit and 64 bit pro*c program
Can u show the error msg?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2004 07:31 PM
тАО08-19-2004 07:31 PM
Re: 32bit and 64 bit pro*c program
What error are you getting?
If it is mismatch ABI then you may have to set your paths correctly.
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-19-2004 08:33 PM
тАО08-19-2004 08:33 PM
Re: 32bit and 64 bit pro*c program
Because you didn't tell *what* error messages you're getting, it's a bit difficult to guess what the actual problem is.
You seem to be assuming that the value of time() is a signed 32-bit integer, or in other words, anything that fits in int.
Don't assume that, or your assumption may come to haunt you on Tuesday 19. of January 2038, at about 03:14 UTC time (the end of the traditional Unix epoch).
Besides, explicitly using time_t type would be better style. It will also make it easier to fix your programs when the real rush to fix Y2038 problems finally begins.
The AIX 64-bit compiler may be already defining time_t as something larger, and you might be getting an error message because of that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2004 11:32 AM
тАО08-20-2004 11:32 AM
Re: 32bit and 64 bit pro*c program
FWIW, the advice about types is likely spot-on. Compiling your bit of test code on an HP-UX 11.11 system (even 32-bit) yielded the following warnings:
$ cc foo.c
cc: "foo.c", line 7: warning 604: Pointers are not assignment-compatible.
cc: "foo.c", line 7: warning 563: Argument #1 is not the correct type.
cc: "foo.c", line 8: warning 604: Pointers are not assignment-compatible.
cc: "foo.c", line 8: warning 563: Argument #1 is not the correct type.
changing the type of "tim" from int to time_t made those warnings go away, and the program compiled without warning or error in 64-bit mode with HP's C compiler. Compiling the original source in 64-bit mode under the HP compiler yields:
$ cc +DD64 foo.c
cc: "foo.c", line 7: warning 729: Argument #1 converts int* to long*.
cc: "foo.c", line 8: warning 729: Argument #1 converts int* to long*.
which, while on the surface seems silly if one thinks a pointer is a pointer, really isnt since an int and a long have different alignment requirements in 64-bit mode - int remains four-byte alignment, but long (LP64 mode) gets an eight-byte alignment requirement.
Now, for posting an AIX question in HP's ITRC Forums, you are now required to go-out and buy some additional HP kit :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 03:28 AM
тАО08-23-2004 03:28 AM
Re: 32bit and 64 bit pro*c program
#include
#include
#include
struct tm when;
time_t now;
time_t result;
int main()
{
time(&now);
when=*localtime(&now);
printf("Month %d\n",when.tm_mon);
printf("Day %d\n",when.tm_mday);
printf("Year %d\n",when.tm_year+1900);
return 1;
}
= Mike =
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 04:36 AM
тАО08-23-2004 04:36 AM
Re: 32bit and 64 bit pro*c program
pro*c is a pre-processor and in theory, will have no effect on anything unless there are some #EXEC SQL lines in your code.
My basic troubleshooting technique is to simplify the problem until it works and then go back step by step until it breaks. Once it breaks you know where to look.
Since the pro*c runs a preprocessor and then the compiler, eliminate the preprocessor step. The other respondents show that they can run the C compiler. Maybe the difference is something that the pro*c is tossing in?
Typically, the pro*c has a .pc extension and emitts a .c file. Check your .c file to see if pro*c has done anything to it? In your example, it should be the same file, just with some extra stuff from pro*c.
-Good Luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 09:19 PM
тАО08-23-2004 09:19 PM