Thread: sizeof int?

  1. #46
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Note that I was not arguing it is practically better to have 64-bit ints. What I meant was, by the standard, int should be 64-bit. It may be practical to deviate from the standard in this case.

    Brewbuck's way of determining the size of an int (a type large enough so that programmers won't feel limited most of the time, yet doesn't waste too much space) is in disagreement of the standard (which says an int should be the natural size suggested by the execution environment, regardless of the amount of space wasted). I like brewbuck's definition better, though. Certainly makes life easier for programmers
    Last edited by cyberfish; 09-14-2009 at 02:32 PM.

  2. #47
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I think that is fair enough.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #48
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by cyberfish View Post
    Brewbuck's way of determining the size of an int (a type large enough so that programmers won't feel limited most of the time, yet doesn't waste too much space) is in disagreement of the standard (which says an int should be the natural size suggested by the execution environment, regardless of the amount of space wasted). I like brewbuck's definition better, though. Certainly makes life easier for programmers
    I think the "natural size" requirement is sufficiently vague as to not directly suggest 64-bit integers on a 64-bit platform. On 64-bit Intel chips which are backward-compatible all the way to 8086, one might argue that a byte is a "natural size" because the chip supports single-byte addressing and has methods for accessing 8-bit register values.

    In other words, just because an architecture supports 64-bit integers doesn't mean that 32-bit integers are any less "natural" in that architecture.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. Replies: 3
    Last Post: 05-13-2007, 08:55 AM
  3. Working with random like dice
    By SebastionV3 in forum C++ Programming
    Replies: 10
    Last Post: 05-26-2006, 09:16 PM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM