c++ - What's the 'long' data type used for? -


i've been programming in c++ quite while , pretty familiar of stuff. 1 thing i've never understood though 'long' data type.

i googled still don't know for. i've found pages same size , has same range int. point in using it?

i found stack overflow question regarding here: difference between long , int data types

and seems difference between 2 size different on different systems. mean application uses long on 64bit machine won't work on 32bit machine? if wouldn't better not use them @ all?

also noticed stuff called "long int" or "long long"! data type or modifier?

it compiler dependent. standards-fu bit rusty believe defined follows:

char <= short <= int <= long <= long long 

where:

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

which means valid have char = short = int = long = long long = 64bits , in fact compilers of dsps designed way.


this underscores importance of reading compiler documentation.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -