Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is long long data type exists

Status
Not open for further replies.

manohar143

Programmer
May 6, 2002
5
US
Hello Friends

I wrote a small program in C

main()
{
long long int a=0;
printf("test program");
printf("\n");
printf("%u%",sizeof(a));
printf("\n");


}

the above program works fine in my Dev C++ complier, actually i saved this file as .c extn...even i tried comipling in ASNI c comiplier...but i have no idea about the version of the compiler. The result of the above file is 8 bytes.

Can you please let me know whether is there any long long data type. If yes why it is not working in Microsoft VC ++ . It gives the following warining.
Copyright (c) Bullseye Testing Technology 1990-2001
Command line warning: -YX not supported, build times may increase dramatically
Noname1.C
D:/Edison/Noname1.C(5) : error C2632: 'long' followed by 'long' is illegal
D:/Edison/Noname1.C(12) : warning C4013: 'system' undefined; assuming extern returning int
warning cov816: original unmodified compile command fails
Error executing cl.exe.


 
Well, some compilers support longlong. A long is a type and a keyword so by typing

long long int a = 0;

the first long is fine but the following long and int keywords are not. long a = 0; or int a = 0; works though. What are you trying to do and maybe i can help.

Matt
 
Dear matt

The above programs works and results me the 8 byte with sizeof function.

main()
{
long long a=0;
printf("test program");
printf("\n");
printf("%u%",sizeof(a));
printf("\n");


}

even this works...ie long long a=0, when i print the value of a it gives me the same 8 bytes.

I am curious to know about the things. How this works, as far i read the things, i never come across the such a data type. It should throw an error. If the same thing i am trying to long float a=0, it gives the following error

d:\dev-c_~1\test.c:5: long or short specified with floating type for `a'
d:\dev-c_~1\test.c:5: the only valid combination is `long double'

then it should give the same error in case of long long a=0

Waiting for ur reply

Manohar
 
Just my 2 cents...

'long long [int]' is an acceptable data type with some c compiliers. I believe, I could be wrong, that this type is a fairly new type. I read something about a C99 Standard which includes this type.

A 'long [int]' is typically 4 bytes, while a 'long long [int]' is 8 bytes. This can also apply to the 'long double'. A 'double' is 8 bytes, while a 'long double' is 12 bytes. (Although this may not be true for all platforms.) There appears to be no long float since you have a double data.

Again,
My 2 cents ... I could be wrong ;-)
 
Just to confirm, lordblood is correct;
Code:
long long
is an acceptable data type in C99. Unfortunately, I don't think many C++ compilers (including Visual C++) support C99 stuff yet (especially since nothing says they have to). So your code that uses
Code:
long long
is correct, just don't expect it to work on all compilers quite yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top