-
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
-
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.
-
-
Code:
tmp.c: In function `main':
tmp.c:4: parse error before `int'
-
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.
-
How do I know that CHAR_BIT is not a standard definition?
Thanks for ur promt reply.
Juganoo
-
-
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.
-
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.
-
Quote:
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.