|
-
August 7th, 2008, 11:09 PM
#1
64bit coding questions
1. When compiling a 64bit app, does it mean that some data types such as unsigned long int will be able to hold more? So rather then being a 32bit variable it would be 64bit?
2. Also can you compile a 64 bit app under a 32 bit OS and still run it?
3. And lastly, if no to question 2, assuming a 64-bit platform in linux or windows, what are the steps to compile a program as a 64 bit program? (without using platform dependent stuff like .net)
-
August 7th, 2008, 11:19 PM
#2
Re: 64bit coding questions
 Originally Posted by Red Squirrel
1. When compiling a 64bit app, does it mean that some data types such as unsigned long int will be able to hold more? So rather then being a 32bit variable it would be 64bit?
Yes, but *which* types get larger is actually platform-dependent. For instance, long int is 32 bits on XP64, but 64 bits on Linux. long long int is 64 bits on both, however; and actually on 32-bit systems as well, although it isn't handled natively there.
Naturally, all pointer types are 64 bit.
This is a concern for standard library calls like fseek() that take a long parameter. On Linux64 they're fine; on Win64, fseek() suddenly becomes obsolete because it can't handle large files, and you need to use alternatives like fsetpos().
2. Also can you compile a 64 bit app under a 32 bit OS and still run it?
Wouldn't count on it, though as I said, 64 bit types do exist for programs compiled for 32 bit machines.
3. And lastly, if no to question 2, assuming a 64-bit platform in linux or windows, what are the steps to compile a program as a 64 bit program? (without using platform dependent stuff like .net)
With gcc it's fairly simple....actually it should use 64-bit mode by default on 64-bit systems. On Visual Studio you need to set up some new configurations, and there are tutorials on how to do that around the web.
-
August 7th, 2008, 11:25 PM
#3
Re: 64bit coding questions
Good to know, thanks. I plan to get into 64bit programming eventually. Next OS change will be a 64 bit one on both my workstation and servers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|