阅读背景:

What data-type shoud be chosen to represent a variable that takes fixed number of values?

来源:互联网 

I have a variable that can take any 3 values. If it can take only 2 values I would have assigned a bool type. But my variable can take 3 values. If I assign a int8_t type I am wasting 6 bits. Though this looks like preemptive optimization, I have millions of instances of this type, which is going to make a huge difference in memory usage.I have a variable that can take any 3 values. I




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: