Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C is shit

Name: Anonymous 2011-11-30 19:50

Why have short and int if by the standard they end up being the same size number of bits.


Is the following correct:

char        => 8 bits
short       => 16 bits
int         => 16 bits
long        => 32 bits
long long   => 64 bits

float       => 32 bits
double      => 64 bits
long double => 128 bits


whats the point of short?

Name: Anonymous 2011-11-30 20:18

>>4
Yes. That's called overhead, and is a common issue everywhere if you are not using bitfields. Using an 8-bit variable to store i in a counting loop is similarily problematic.

If you feel like being practicularly crafty you can implement a piece of code that checks the machine's specific limits, saves them, and then uses those limits to pick an optimal piece of code that will run from then on, or use the C preprocessor.

Don't bother with this unless you really really need to save that space.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List