Is there a 24-bit var in C++?
Printable View
Is there a 24-bit var in C++?
thanks it's 3 bytes but i can't figerout how to use it.
I tried to use it like this foo=0; and i get the error
error C2440: '=' : cannot convert from 'const int' to 'unsigned char [3]'
There are no conversions to array types, although there are conversions to references or pointers to arrays
how can i fix this?
you just do:
foo poo;
poo.myvar
it will have all the proper operations defined for it.
EDIT: That would, of course, be for the bitfield, not the array. There is no direct way to use the array version.
That was weird it used my friends name. He logged in once on my pc and about a month or so but it shouldn't do that
thanks
no wait it get the error:
error C2228: left of '.myvar' must have class/struct/union type
from doing
foo.myvar=0;
it acts like a 24bit but it takes 4bytes can this be fixed?
I do sizeof(poo); and it gets 4 if i do
sizeof(poo.myvar) i get the error
error C2070: illegal sizeof operand
ya i got VC++ that sucks
I just wanted to see if it was possable and wanted to save some space in ram if i only need to go 16 million. I also wanted to save some space in files but i could just make a fuction to do that my self.