HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- What is the different between 32bits and 64bits fo...
Operating System - HP-UX
1834055
Members
2552
Online
110063
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
Forums
Discussions
Discussions
Discussions
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
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
05-19-2005 05:34 AM
05-19-2005 05:34 AM
How to define the data type of 4 bytes integer with 64bits compiler options? and 1 byte char, 4 bytes float...
Where can I find some documents about it?
Best Regards.
Where can I find some documents about it?
Best Regards.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 08:01 AM
05-19-2005 08:01 AM
Solution
The best way to answer your question is to ask the machine itself.
Compiles the attached C program thusly:
cc +DD64 sizes.c -o sizes64
cc +DD32 sizes.c -o sizes32
and then execute each program.
The documentation for this is found under /opt/ansic/html
Here is a quote from one of the .html's that illustrates a good technique for portability.
------------------------------------------
Improving Portability
Type definitions can be used to compensate for differences in C compilers. For example:
#if SMALL_COMPUTER
typedef int SHORTINT;
typedef long LONGINT;
#elif
BIG_COMPUTER
typedef short SHORTINT;
typedef int LONGINT;
#endif
This is useful when writing code to run on two computers, a small computer where an int is two bytes, and a large computer where an int is four bytes. Instead of using short, long, and int, you can use SHORTINT and LONGINT and be assured that SHORTINT is two bytes and LONGINT is four bytes regardless of the machine.
-------------------------------------
I have used a similar technique for many years so that I never use the native types but rather use a typedef'ed version.
Compiles the attached C program thusly:
cc +DD64 sizes.c -o sizes64
cc +DD32 sizes.c -o sizes32
and then execute each program.
The documentation for this is found under /opt/ansic/html
Here is a quote from one of the .html's that illustrates a good technique for portability.
------------------------------------------
Improving Portability
Type definitions can be used to compensate for differences in C compilers. For example:
#if SMALL_COMPUTER
typedef int SHORTINT;
typedef long LONGINT;
#elif
BIG_COMPUTER
typedef short SHORTINT;
typedef int LONGINT;
#endif
This is useful when writing code to run on two computers, a small computer where an int is two bytes, and a large computer where an int is four bytes. Instead of using short, long, and int, you can use SHORTINT and LONGINT and be assured that SHORTINT is two bytes and LONGINT is four bytes regardless of the machine.
-------------------------------------
I have used a similar technique for many years so that I never use the native types but rather use a typedef'ed version.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 08:02 AM
05-19-2005 08:02 AM
Re: What is the different between 32bits and 64bits for data types in C?
Ooops, I missed the sizes.c attachment.
If it ain't broke, I can fix that.
- Tags:
- missing attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2005 01:18 AM
05-21-2005 01:18 AM
Re: What is the different between 32bits and 64bits for data types in C?
Thank you!
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP