Re: vector and bool
Nonenix (astalavista.ne t) wrote:[color=blue]
> hmm not sure but i think somethink lieke that can be done with structures i
> mena this:
>
>
> struct item {
>
> unsigned int IsTrue:1;
> unsigned int watever:1;
> unsigned int number:14;
>
> }
>
> some cpu dosen't support that or the compiler doesen't use it because of
> speed loss
>
> but if it work is should looks like this in the ram:
>
> 0 | 1 | 2.............1 5 |
> IsTrue | waterver | number |
>
>
> you could use it like an int but IMPORTANT
>
> if you forgot the unsignet the int will always be 0[/color]
Why?
[color=blue]
> gnu says this:
>
> ..cpp: In function 'int main()':
> ...cpp:13: warning: comparison is always 0 due to width of bitfield[/color]
May you provide that code?
Actually it could be even like this:
struct item
{
bool a:1;
bool b:1;
bool c:1;
bool d:1;
};
--
Ioannis Vranos
Nonenix (astalavista.ne t) wrote:[color=blue]
> hmm not sure but i think somethink lieke that can be done with structures i
> mena this:
>
>
> struct item {
>
> unsigned int IsTrue:1;
> unsigned int watever:1;
> unsigned int number:14;
>
> }
>
> some cpu dosen't support that or the compiler doesen't use it because of
> speed loss
>
> but if it work is should looks like this in the ram:
>
> 0 | 1 | 2.............1 5 |
> IsTrue | waterver | number |
>
>
> you could use it like an int but IMPORTANT
>
> if you forgot the unsignet the int will always be 0[/color]
Why?
[color=blue]
> gnu says this:
>
> ..cpp: In function 'int main()':
> ...cpp:13: warning: comparison is always 0 due to width of bitfield[/color]
May you provide that code?
Actually it could be even like this:
struct item
{
bool a:1;
bool b:1;
bool c:1;
bool d:1;
};
--
Ioannis Vranos
Comment