- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Migrating source code from 32 to 64 bits
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
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
тАО10-08-2008 01:33 AM
тАО10-08-2008 01:33 AM
I'm compiling an app. from Pa-RISC 32 bits to Itanium 64 bits. I compile it fine (cc +DD64), linking with 64 bits libraries (i also use oracle libraries). I solved the warning messages that i didn't see when i compile under 32 bits.
I think all is OK. But the same program show different results that under 32 bits.
My questions are: Are there any kind of differences in source code (ANSI C) from 32 to 64 bits? Are the variable length equals?
Is the first time i have to program under 64 bits, i don't know if i have to learn something different or not!!
Thanks!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 08:18 AM
тАО10-08-2008 08:18 AM
SolutionPointers aren't. If you have doubts, write a
small test program, build it (both ways), and
run the resulting executables. For example:
alp $ type siz.c
#include
main()
{
printf( " char = %d, int = %d, long = %d, long long = %d, void* = %d.\n",
sizeof( char), sizeof( int), sizeof( long),
sizeof( long long), sizeof( void *));
}
> But the same program show different results
> that under 32 bits.
Choose one problem and debug it. I would
expect you to learn more from that experience
than you will from any guesses I could make
without being able to see any of your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 09:13 AM
тАО10-08-2008 09:13 AM
Re: Migrating source code from 32 to 64 bits
I have been reading info about 64 bits programming. I see the differences about 'long' and 'pointers' length. By the moment i will steel working under 32 bits, because i'm also migrating from PA-RISC to Itanium. When my programs works fine in Itanium (under 32 bits), i will study more about 64 bits programming and the changes i have to do in my source code. It are requeriments of my boss.
Surely i'll ask here another questions in a future.
Thanks so much!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 09:42 AM
тАО10-08-2008 09:42 AM
Re: Migrating source code from 32 to 64 bits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 09:44 AM
тАО10-08-2008 09:44 AM
Re: Migrating source code from 32 to 64 bits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 08:57 PM
тАО10-08-2008 08:57 PM
Re: Migrating source code from 32 to 64 bits
There is no requirement to go to 64 bit. You should ask your boss why he thinks 64 bit is needed??
>Is the first time I have to program under 64 bits, I don't know if I have to learn something different or not!!
You have to port to 64 bit, i.e to do work and know what you are doing.
There are a +wlint +w64bit options to help you.
Have you seen the documentation under:
http://www.hp.com/go/cpp
HP-UX 64-bit porting and transition guide
http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801/?ciid=2308852bcbe02110852bcbe02110275d6e10RCRD
>Steven: build it (both ways) printf(" char = %d, ... sizeof(char),
This already violates 64 bit porting. The correct format on HP-UX is: %ld
Even more pedantically: %lu
Or C99 perfection on 11.31: %z
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 10:37 PM
тАО10-08-2008 10:37 PM
Re: Migrating source code from 32 to 64 bits
How? "sizeof" isn't an int? "%d" doesn't
work with an int?
Please point me to the docs which explain
this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 11:50 PM
тАО10-08-2008 11:50 PM
Re: Migrating source code from 32 to 64 bits
I don't know why my boss (above the customer) loves 64 bits... I don't mind it, i only have to do what they order me!
I'm seeing that i'll have problems in the treatment of 'long' and pointers. When i know something more about the world where i'm entering, i'll start to ask you over and over.
Thanks so much!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2008 03:19 AM
тАО10-09-2008 03:19 AM
Re: Migrating source code from 32 to 64 bits
No, sizeof is a size_t. On HP-UX that's a unsigned long.
>Please point me to the docs which explain this.
The C or C++ Standards?
http://docs.hp.com/en/B3901-90020/ch05s13.html
>I don't know why my boss (above the customer) loves 64 bits
It should be clear in his mind, at least enough to explain to you. Some valid reasons are:
1) Wants to port to Linux on Integrity.
2) Needs more address space because it is close to the 2 Gb limit.
3) Third party shlibs only come in 64 bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2008 04:37 AM
тАО10-09-2008 04:37 AM
Re: Migrating source code from 32 to 64 bits
I have a doubt with my code.
I have a 'long field' variable, and on another side i get, via Oracle SQLDA structures, data from my DB. Look at this line:
--- field = *(long *)std_outp->V[0];
Really, it's a conversion from 'char **' to 'long'. It works perfectly under 32 bits. An example of my values at this point:
>>>>>>> std_outp->V[0] = '989999'
>>>>>>> field = 989999
But, compiled under 64 bits, it gives me:
>>>>>>> std_outp->V[0] = '989999'
>>>>>>> field = 4252013328072704
To do fine the 'cast', i have to type:
--- field = *(int *)std_outp->V[0];
I know the problem is in the length of pointers and 'long' under 64 bits. But i find this conversion, via 'int', something 'horrible', i think that there has to be another way more 'beautiful' to do the cast. Are there?
Thanks in advance!