CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Posts
    609

    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)
    http://www.uovalor.com :: Free UO Server

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: 64bit coding questions

    Quote 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.

  3. #3
    Join Date
    Jul 2007
    Posts
    609

    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.
    http://www.uovalor.com :: Free UO Server

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured