Page 1 of 1
what data type is fast ?
Posted: Sun Feb 27, 2005 2:48 pm
by mohiul alam prince
Hi
what data type is fast ?
-bool
-char
if u know please reply me.
MAP
Posted: Sun Feb 27, 2005 11:23 pm
by Larry
They both use up one byte.. and there isn't really a bool in pure C..
Posted: Mon Feb 28, 2005 8:11 am
by shamim
say, if bool and char use up one byte, then what was the point of introducing bool type in ANSI C++, is it just to be in accordance with other languages that have a bool data type.
Posted: Mon Feb 28, 2005 10:03 am
by sumankar
AFAIK the latest C standard defines two things:
1. bool data type (for which you need the stdbool.h header)
2. _Bool in case you don't want the former breaking legacy code,
this one being a macro with the added advantage that it can #undef-ed.
I will need to look up the size of the former though, but most likely as with others it must be left to the implementors.
Regards,
Suman.
Posted: Mon Feb 28, 2005 1:35 pm
by little joey
Code: Select all
joachim@joabox[bool]$ gcc -dumpversion
3.3.4
joachim@joabox[bool]$ cat testbool.c
#include <stdio.h>
#include <stdbool.h>
int main(){
printf("%d\n",sizeof(bool));
return 0;
}
joachim@joabox[bool]$ gcc testbool.c
joachim@joabox[bool]$ a.out
1
joachim@joabox[bool]$
Posted: Mon Feb 28, 2005 2:41 pm
by mohiul alam prince
Hi
which data type is profitable for visit a index char of bool.
- I want to add two value with bit operation how can i do that. and also
multiplication.
- Is there any bit wise visiting operation. (that i can get very quickly)
If any body know about this thing please reply me.
thankx
MAP
Posted: Tue Mar 01, 2005 11:51 am
by shamim
Mohiul, this post will not fulfill your requirement entirely, but I advise you to study bitset of C++ STL. There are features that might interest you.

Posted: Mon May 16, 2005 8:23 am
by Ronald29
mohiul, do you want to access a variable in bit? you can use the bit wise operation, use the '&' operator
Posted: Mon May 16, 2005 8:27 am
by Ronald29
mohiul, do you want to access a variable in bit? you can use the bit wise operation, use the '&' operator