Thread: 16 bit or 32 bit

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    38

    16 bit or 32 bit

    Given a compiler file( .exe file) how do I know, whether compiler is 16 bit or 32 bit?

    I have BC4.0, is it 16 bit compiler or 32 bit compiler?

    What is difference between bcc.exe bcc32.exe?

    Can anybody tell me, where can download Borland C++ 3.1?

    Thanks in advance..
    Juganoo

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    #include <stdio.h>
    int main ( void )
    {
        return printf( "sizeof int is %d, thus your compiler is a %d bit compiler.\n",  sizeof int, sizeof int * CHAR_BITS  );
    }
    That should do it.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    38
    what is CHAR_BITS ?

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Code:
    tmp.c: In function `main':
    tmp.c:4: parse error before `int'
    The world is waiting. I must leave you now.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Apparently CHAR_BITS (or CHAR_BIT) isn't a standard definition. I guess you learn something new every day. (Either that or MSVC++ just doesn't have it.)

    CHAR_BIT (or _BITS) is the number of bits in a single 'char'.

    In this case, replace it with 8, which should do the job.

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    38
    How do I know that CHAR_BIT is not a standard definition?

    Thanks for ur promt reply.

    Juganoo

  7. #7
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    #include<limits.h>
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Doh. I was thinking for some odd reason that limits.h was referred to by stdilb. Thanks for the correction. And it looks like it should be "CHAR_BIT" not "CHAR_BITS".

    Quzah.
    Last edited by quzah; 12-18-2002 at 08:42 PM.
    Hope is the first step on the road to disappointment.

  9. #9
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Code:
    printf( "sizeof int is %d, thus your compiler is a %d bit compiler.\n",  sizeof int, sizeof(int) << 3);
    But then again this would probably seem even more confusing to a newbie.

  10. #10
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by master5001
    Code:
    printf( "sizeof int is %d, thus your compiler is a %d bit compiler.\n",  sizeof int, sizeof(int) << 3);
    But then again this would probably seem even more confusing to a newbie.
    a byte is not guaranteed to have 8 bits; using CHAR_BIT is the only correct way.
    hello, internet!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 05-21-2009, 05:47 PM
  2. counting 16 bit number from a buffer
    By baccardi in forum C Programming
    Replies: 4
    Last Post: 02-20-2009, 03:28 PM
  3. adding 16bit and 32 bit integers
    By kris_perry2k in forum C Programming
    Replies: 2
    Last Post: 12-08-2005, 09:49 AM
  4. really weird behavior, 16 bit asm w/masm
    By BobMcGee123 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-01-2005, 06:45 PM
  5. 16 bit colors
    By morbuz in forum Game Programming
    Replies: 13
    Last Post: 11-10-2001, 01:49 AM