Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there such a thing as a 64bit int in c++?

Tags:

c++

64-bit

Is there a real platform/compiler combo that defines int as 64 bits? Or is this just used to scare new programmers like myself into using int32_t where size matters (e.g. saving to a file) in order to make it "portable"?

like image 618
Baruch Avatar asked Mar 01 '11 21:03

Baruch


People also ask

What is a 64-bit integer in C?

64-bit unsigned integer type is used to store only pozitiv whole number. 64-bit unsigned integer and his value range: from 0 to 18446744073709551615.

Can integer be a 64 bits?

A 64-bit signed integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive). A 64-bit unsigned integer. It has a minimum value of 0 and a maximum value of (2^64)-1 (inclusive).

Is int always 32 bits in C?

int is always 32 bits wide. sizeof(T) represents the number of 8-bit bytes (octets) needed to store a variable of type T .


2 Answers

There absolutely are such systems. There may be more in the future (or there may not). And do you want to take a bet on what int will be on a possible 128-bit architecture?

Wikipedia has an incomplete-but-useful rundown: http://en.wikipedia.org/wiki/64-bit#64-bit_data_models

like image 88
Nicholas Knight Avatar answered Oct 13 '22 09:10

Nicholas Knight


I believe that in c99 long long is usually 64 bit. gcc and microsoft both use this convention.

http://jk-technology.com/c/inttypes.html#long_long

like image 42
KitsuneYMG Avatar answered Oct 13 '22 09:10

KitsuneYMG