Thread: The 64-bit thread

  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446

    The 64-bit thread

    There was a time when I was constantly on top of these things. But that was from the 8086 days up until Pentium II. Then I lost much interest in hardware and started concentrating on not upgrading my computer every 8 months.

    However the 64-bit "revolution" seems to bring with it some quirks that I must watch out for. I need your help, folks, to understand a few points.

    You don't need to answer everything, of course. Just do it at your own pace and volition. But, lets discuss 64-bit; what it is, what it is not, what you expect it to be, and in the meantime help me put some order on everything I read or hear about it and that for the most part is contradicting.


    What's at stake considering programming in C++
    - These compiler toolchains, what are they?
    - What type of code compiled on a 32-bit machine will not run on a 64-bit one?
    - What type of code compile on a 64-bit machine will run on a 32-bit one?
    - Have variable types increased in size (capacity)?
    - Is there an effort between the major players to agree on a common size?
    - What side effects are expected from 64-bit compiled applications in terms of size and speed?
    - What's the expected ratio of memory requirements increase? And disk?

    The 64-bit hype
    - Considering 32-bit systems accompanied much of the software development during some of its most productive years, do you expect 32-bit machines to finally disappear in 5 years? 10? Maybe later? Much sooner?
    - What's in your general opinion the current state in terms of compilers, debuggers, profilers and overall industry support for 64-bit machines?
    - Should I consider an upgrade today? In 1 year? 2? 5?

    Legacy
    - Do you expect 32-bit machines to enjoy a longer period as legacy systems than 16-bits enjoyed (and still enjoy to some extent)?
    - Do you expect it to be more prolific then 16-bit solution were once they became old-fashioned?

    Future
    - Generally what are the advantages of 64-bit systems?
    - Any disadvantages?
    - Keeping with current materials, but expecting better and more refined tools, do you think 64-bit is not the end of it?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    What's at stake considering programming in C++
    - Have variable types increased in size (capacity)?
    In C (with GCC) at least, longs under 64-bit systems are still 32 bits, but long longs are 64 bits. I'm pretty sure that (for most compilers), longs are the same size, in C and C++.

    - Any disadvantages?
    Well, for Linux, you need the 32-bit runtime libraries as well as the 64-bit ones, if you want to be able to run 64-bit programs as well as 32-bit ones, like most people.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    What type of code compiled on a 32-bit machine will not run on a 64-bit one?
    It should all run. Most 64-bit CPUs implement the 64bit instruction set as an extension to the 32bit instructions.

    What type of code compile on a 64-bit machine will run on a 32-bit one?
    Code compiled targeting a 64-bit machine will not run on a 32-bit machine, AFAIK.

    Have variable types increased in size (capacity)?
    In addition to what dwks said, pointers are 64-bit.

    - Generally what are the advantages of 64-bit systems?
    Larger possible RAM sizes, and in some cases it's faster. Although I'm not sure what those cases are. I haven't seen them, I know that.
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    If I recall correctly long long is expected for C++0x too, right?

    Wouldn't it to be expected floating point numbers to also take advantage of the wider data bus and see, if not a change in current variables, some form of a "long double"?

    Quote Originally Posted by psychopath
    In addition to what dwks said, pointers are 64-bit.
    hmm... this puts a burden on current memory requirements for applications built for 64-bit machines. Correct?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    One thing I recall that you may also want to consider is the operating system.
    https://cboard.cprogramming.com/showthread.php?p=468408
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by Mario F. View Post
    - Have variable types increased in size (capacity)?
    ints are the size of the data bus. 16 bit computers have 16 bit ints, 32 bit computers have 32 bit ints, and 64 bit computers have 64 bit ints, etc.
    - What side effects are expected from 64-bit compiled applications in terms of size and speed?
    data would be pushed around in bigger chunks, therefore faster given other factors equal.
    - Considering 32-bit systems accompanied much of the software development during some of its most productive years, do you expect 32-bit machines to finally disappear in 5 years? 10? Maybe later? Much sooner?
    depends on the market demand for them.
    - What's in your general opinion the current state in terms of compilers, debuggers, profilers and overall industry support for 64-bit machines?
    beta, but stable
    - Should I consider an upgrade today? In 1 year? 2? 5?
    I'd play it by ear.
    - Do you expect 32-bit machines to enjoy a longer period as legacy systems than 16-bits enjoyed (and still enjoy to some extent)?
    yes. There are few applications that can take advantage of 64 bit
    - Do you expect it to be more prolific then 16-bit solution were once they became old-fashioned?
    depends on the adoption gradient.
    - Any disadvantages?
    higher minimum addressable memory block size, larger memory pointers, more power consumption.
    - Keeping with current materials, but expecting better and more refined tools, do you think 64-bit is not the end of it?
    there are already 128bit processors.

  7. #7
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by robwhit View Post
    ints are the size of the data bus. 16 bit computers have 16 bit ints, 32 bit computers have 32 bit ints, and 64 bit computers have 64 bit ints, etc.
    Maybe.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Address bus?

  9. #9
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by robwhit
    Is there any motivation behind 64-bityes. There are few applications that can take advantage of 64 bit
    You mean as a consequence of these applications requirements or because there aren't enough 64-bit application out there yet?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  10. #10
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by robwhit View Post
    Address bus?
    I've had the most fun on platforms with 3 or more buses.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  11. #11
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by Mario F. View Post
    You mean as a consequence of these applications requirements or because there aren't enough 64-bit application out there yet?
    imo, the only applications that can take advantage of 64-bit are intensive calculation or io applications like servers, rendering farms, games, etc. 32-bit processing power has already exceeded demand for many other applications, I think.
    Last edited by robwhit; 07-04-2007 at 07:16 PM.

  12. #12
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Quote Originally Posted by Mario F. View Post
    • What type of code compiled on a 32-bit machine will not run on a 64-bit one?
    • What type of code compile on a 64-bit machine will run on a 32-bit one?
    I've a bit of 32 -> 64 bit porting, and as far as I can tell, there is only one error which can get past a compiler...
    And it's a really nasty one.

    Code:
    class RTTI_hell {
    	public:
    		enum {
    			NAME, NUM
    		} type;
    
    		void const * data;
    
    		RTTI_hell (char const * name) : type(NAME), data(name) { }
    		RTTI_hell (size_t i) : type(NUM), data(new size_t(i)) { }
    
    		char const * get_name() { return (char const *) data; }
    		unsigned long get_num() { return *(unsigned long *)data; }
    
    };
    Yes, it's bad code, but it's code that works, even cross platform usually. It's also real code. This is of course a very simplified example.

    What happens is that when you change to 64 bit, size_t gets bigger than unsigned long, so you end up with bus errors, or possibly just junk output. It's a hell of an error since you can't possibly catch it before run time.

    On the bright side, I'm pretty sure that besides bus errors, porting is painless, as long as you can access 64 bit versions of all the libraries you need.


    One other note... 64 bit computing really isn't all that new. Sun has been putting out 64 bit SPARCs for over 10 years now. The reason they're starting to become more mainstream is the memory requirements for 'normal' programs are getting closer and closer to the 4 Gig address limit.

    The truth of it is, it's a lot cheaper, for many applications, to just buy more memory than to pay a programmer to 'fix' an inefficient program.
    Callou collei we'll code the way
    Of prime numbers and pings!

  13. #13
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    but it's code that works, even cross platform usually
    Just of curiosity - why to store size_t value and return unsigned long value... And why not to use union with proper type-checking if you so eager to save memory?..
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  14. #14
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Ah, one more thing...
    If the past is any indicator, then we'll start moving consumer desktops to 128 bits at around the same time it becomes normal to talk about RAM on the scale of exabytes. That is... a -lot- of memory, but I wouldn't be surprised to see it happen in 20-30 years.
    Callou collei we'll code the way
    Of prime numbers and pings!

  15. #15
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Quote Originally Posted by vart View Post
    Just of curiosity - why to store size_t value and return unsigned long value... And why not to use union with proper type-checking if you so eager to save memory?..
    Understand that this is a simplified example. There's no logical reason for it to be implemented the way it is, but when you have a very large code base with multiple coders maintaining it, with logic that spans multiple files, it's easy to use "size_t" one place and "unsigned long" another.

    And as for "Why not do it this way?", simply because the code I posted -works-. If bad code works, bad code will be written. In any large code base, you are somewhat doomed because there are uncountable ways to write bad code that works, combined with far too much code for any being to consider all at once.
    Callou collei we'll code the way
    Of prime numbers and pings!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 64 bit programs
    By learning in forum C++ Programming
    Replies: 17
    Last Post: 05-10-2007, 11:26 PM
  2. C++ Threading?
    By draggy in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2005, 12:16 PM
  3. 64 bit variables
    By Yawgmoth in forum C Programming
    Replies: 11
    Last Post: 12-19-2002, 01:55 PM
  4. 64 bit
    By stormbringer in forum C Programming
    Replies: 2
    Last Post: 10-29-2002, 06:51 PM