Does SoloLearn compiler use a 32BIT data type for long int, and why it is so? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does SoloLearn compiler use a 32BIT data type for long int, and why it is so?

I was testing a long int variable and seems to be 4byte like an int variable where I thought that it is 8Byte. Does SoloLearn app uses a 32BIT Compiler? https://code.sololearn.com/cXZpCHVqYgkk/?ref=app

15th May 2019, 6:49 PM
Michael Buzgaru
Michael Buzgaru - avatar
19 Answers
+ 2
Michael Buzgaru If you try to printf("%d", sizeof(void*)); you'll see 8 that is for 64bit compiler. Am i right?
15th May 2019, 6:57 PM
Imil Familiev
Imil Familiev - avatar
+ 2
Michael Buzgaru It is Windows Server 2012 R2. Check this (modified) https://code.sololearn.com/cTom7CtXK2rt/?ref=app
15th May 2019, 8:51 PM
Imil Familiev
Imil Familiev - avatar
+ 1
Michael Buzgaru This printf("%d\n", __GNUC__); printf("%s\n", __VERSION__); printf("%d\n", __amd64__); tells that it's 64 bit compiler here. Gcc 7.2.0
15th May 2019, 7:39 PM
Imil Familiev
Imil Familiev - avatar
+ 1
Robin Michael Buzgaru Sololearn compiler fails on __LP64__ so here long int is 32 bit. But the compiler itself is 64 bit.
15th May 2019, 7:53 PM
Imil Familiev
Imil Familiev - avatar
15th May 2019, 8:25 PM
Imil Familiev
Imil Familiev - avatar
+ 1
Michael Buzgaru Yeah it was wondering for me too
15th May 2019, 8:30 PM
Imil Familiev
Imil Familiev - avatar
+ 1
Imil Familiev It is windows 8 (6.2) https://code.sololearn.com/c4ut4xN1o5KN/?ref=app
15th May 2019, 8:38 PM
Michael Buzgaru
Michael Buzgaru - avatar
+ 1
Michael Buzgaru If you looked at Wikipedia you just didn't scroll enough till server's versions
15th May 2019, 8:55 PM
Imil Familiev
Imil Familiev - avatar
+ 1
I have one. Checking it
15th May 2019, 9:07 PM
Imil Familiev
Imil Familiev - avatar
0
Well I realised that. Did you checked my added Code? On ideone I get the expected output =>> https://ideone.com/GdRD4a why is here different?
15th May 2019, 7:00 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
That's my Question. What exactly is long int here;): #include <stdio.h> int main( void ) { printf( "size of long int is %u\n",sizeof ( long int) ); } The following returns 4 and if the compiler is 64BIT I was expecting to be 8. I think that SoloLearn uses GCC-7 And from what I know it should be 8.
15th May 2019, 7:18 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
I would like to know some information about the Application Binary Interface uses SoloLearn on its platform if that is possible. There should be the Answer I am searching.
15th May 2019, 8:02 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
Jamie Could you please share me a name of a modern 64BIT linux platform where a compiler uses 4byte for long int?
15th May 2019, 8:04 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
Imil Familiev Oh, my bad. I was thinking that SoloLearn uses Linux. I am not sure why I was thinking that. That explains a lot.
15th May 2019, 8:28 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
Imil Familiev I am wondering why I get 6.2 which is related to windows 8. Hm.
15th May 2019, 8:53 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
Imil Familiev Do you have a windows computer? Can you please run this code on your windows and share me the output? https://code.sololearn.com/cc7hxrhGfCad/?ref=app
15th May 2019, 8:57 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
Imil Familiev It uses LLP64 model wich makes it 32 bit model with 64 bit arhitecture and this is the answer why uses 4byte for long. This means that the compiler needs to do what windows asks. I hate windows :| . . Later Edit: for those who does not know what LLP64 is read the whole article please =>> http://www.unix.org/version2/whatsnew/lp64_wp.html
15th May 2019, 9:09 PM
Michael Buzgaru
Michael Buzgaru - avatar
0
Can't configure vs2010 to make x64 app. By default it makes x86 so output is 32-bit
15th May 2019, 9:51 PM
Imil Familiev
Imil Familiev - avatar
0
Michael Buzgaru My Win7 x64 is also LLP. It prints 4 on the sizeof long, sizeof long int but 8 on the size of pointer. And it print 32-bit at your last code.
15th May 2019, 10:15 PM
Imil Familiev
Imil Familiev - avatar