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
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?
+ 2
Michael Buzgaru
It is Windows Server 2012 R2.
Check this (modified)
https://code.sololearn.com/cTom7CtXK2rt/?ref=app
+ 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
+ 1
Robin Michael Buzgaru
Sololearn compiler fails on __LP64__ so here long int is 32 bit. But the compiler itself is 64 bit.
+ 1
Michael Buzgaru Robin Jamie💐
Sololearn under Windows, is it?
https://code.sololearn.com/cTom7CtXK2rt/?ref=app
+ 1
Michael Buzgaru
Yeah it was wondering for me too
+ 1
Imil Familiev
It is windows 8 (6.2)
https://code.sololearn.com/c4ut4xN1o5KN/?ref=app
+ 1
Michael Buzgaru
If you looked at Wikipedia you just didn't scroll enough till server's versions
+ 1
I have one. Checking it
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?
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.
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.
0
Jamie
Could you please share me a name of a modern 64BIT linux platform where a compiler uses 4byte for long int?
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.
0
Imil Familiev
I am wondering why I get 6.2 which is related to windows 8. Hm.
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
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
0
Can't configure vs2010 to make x64 app. By default it makes x86 so output is 32-bit
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.