on 16-bit system long will guarantee 4-bit integer type?

This is a discussion on on 16-bit system long will guarantee 4-bit integer type? within the C++ Programming forums, part of the General Programming Boards category; Hi To cut the long story short. The books says int is system dependant, short takes 2 bytes and long ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    254

    on 16-bit system long will guarantee 4-bit integer type?

    Hi

    To cut the long story short. The books says int is system dependant, short takes 2 bytes and long takes 4 bytes and are system independent.

    First, could you please tell me what that 16-bit, 32-bit and 64-bit systems are? Please remember I'm a beginner and if you think the reply is going to fly over my head then you can simply tell me.

    Second, it says using long on 16-bit system such as MS-DOS will gurantee a four-bit integer. But long takes always four bytes and is system independent. There are only two bytes in 16 bits. Could you please shed some light on this if yu think I could understand this stuff?

    I offer my thanks for your help and time.

    Regards
    J
    I'm an outright beginner. Using Win XP Pro and Code::Blocks. Be nice to me, please.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,712
    Quote Originally Posted by jackson6612
    To cut the long story short. The books says int is system dependant, short takes 2 bytes and long takes 4 bytes and are system independent.
    Whatever books you are reading, they are wrong if they really state it as that. It is guaranteed that sizeof(short) <= sizeof(int) and sizeof(int) <= sizeof(long). Also, assuming an 8-bit byte, the minimum guaranteed ranges for short, int and long mean that sizeof(short) >= 2, sizeof(int) >= 2 and sizeof(long) >= 4.

    Quote Originally Posted by jackson6612
    First, could you please tell me what that 16-bit, 32-bit and 64-bit systems are? Please remember I'm a beginner and if you think the reply is going to fly over my head then you can simply tell me.
    Have you tried searching the Web? Explanations seem rather readily available online.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  4. All u wanted to know about data types&more
    By SAMSAM in forum Windows Programming
    Replies: 6
    Last Post: 03-11-2003, 02:22 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21