Questions tagged [long-long]

The `long long` size modifier was introduced in C++11 and can be used with integral types to select an integer of at least 64 bits.

See cppreference for more information.

131 questions
3
votes
2 answers

If on my machine sizeof(long) == sizeof(long long), why aren't they the same type?

If I run: #include #include int main() { std::cout << "sizeof(long) = " << sizeof(long) << "\n"; std::cout << "sizeof(long long) = " << sizeof(long long) << "\n"; std::cout << "std::is_same
einpoklum
  • 118,144
  • 57
  • 340
  • 684
3
votes
1 answer

How to bridge a long long C macro to Swift?

In Foundation there is C macro NSURLResponseUnknownLength defined as a long long: #define NSURLResponseUnknownLength ((long long)-1) Due to the way macros are bridged to Swift, this constant is accessible in an Objective-C application, but not in a…
JAL
  • 41,701
  • 23
  • 172
  • 300
3
votes
0 answers

Selecting 'long' versus 'long long' as 64-bit type under LP64/ILP64/LLP64 data models?

I'm trying to understand the requirements for selecting a built-in 64-bit data type using either long or long long. I'm having trouble understanding the type equivalence and the alignment requirements of long versus long long. What is the best…
jww
  • 97,681
  • 90
  • 411
  • 885
3
votes
1 answer

Qt : from unsigned long long to QJsonObject

Is it possible to use long long as a value at QJsonObject ? I was forced to change my API from JSON to XML because 1 field I got had BigInt values and aparently I can't extract big numbers from QJsonValue. Here's my peace of code that may show what…
Rafael Fontes
  • 1,195
  • 11
  • 19
3
votes
1 answer

Is it possible to add -pedantic to GCC command line, yet have it not warn about 'long long'

I'm using mostly GCC to develop my library, but I'd like to ensure cross-compiler compatibility and especially standard conformance as much as possible. For this, I have add several -W... flags to command line. I'd also add -pedantic, but I have a…
user319799
3
votes
2 answers

Accelerating performance of loop performing unsigned long long modulo operation

I need to perform a many operations of finding remainders of the division unsigned long long number by the 16-bit modulus: unsigned long long largeNumber; long residues[100]; unsigned long modules[100]; intiModules(modules); //set different 16-bit…
Konstantin Isupov
  • 199
  • 1
  • 2
  • 12
3
votes
6 answers

confuse in "double to long long" in c++

my code: int main() { long long a = pow(2,63) - 1; long long b = pow(2,63); double c = pow(2,63) - 1; double d = pow(2,63); printf("%lld %lld \n%f %f \n%lld %lld\n", a, b, c, d, (long long)c, (long long)d); return 0; } and the excute result is…
tenos
  • 909
  • 1
  • 9
  • 16
3
votes
0 answers

Same C code gives different outputs on IDEONE and PC

#include int main() { long long i,j; for(i = 1,j = 100;i<5000;i+= 50,j+=23) printf("%lld %lld\n",i,j); return 0; } The output for this code on IDEONE can be seen here : http://ideone.com/YCbc9V I am using GCC 4.8.1 on…
reb94
  • 139
  • 1
  • 2
  • 8
3
votes
3 answers

Objective-C NSNumber numberWithLongLong creates integer

When I attempt to create an NSNumber using the numberWithLongLong with a number greater than -2 and less than 13 it returns a number that is casted as an (int). I see this if I look at the Xcode debugger after stepping over my line. NSNumber*…
3
votes
4 answers

How can I convert from LONGLONG to class _variant_t?

In this example m_Amount is CString. stringToNumber function converts it to a LONGLONG number successfully. But when I want to assign it to a variant I get this error: error C2440: 'type cast' : cannot convert from '__int64' to 'class…
Bob
  • 22,810
  • 38
  • 143
  • 225
2
votes
5 answers

How to cross-platform converting char* to long long (64-bit)?

How can I convert a char* string to long long (64-bit) integer? I use MSVC and GCC compilers and my platforms are Windows, Linux and MAC OS. Thanks.
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
2
votes
2 answers

Buggy transfer of single long long numbers to int array

I’m trying to grab a Long Long Int and split each place number into it’s own spot in an array, in order of course, with array[0] being the largest number. So for instance, if the number was 314, then array[0] = 3, array[1] =1, and array[2] = 4. This…
ezra_vdj
  • 133
  • 5
2
votes
3 answers

Pointer conversion to long porting issue in 64 bit env

I'm porting an application from 32 bit to 64 bit. It is C style coding (legacy product) although it is C++. I have an issue where a combination of union and struct are used to store values. Here a custom datatype called "Any" is used that should…
Reji
  • 21
  • 1
2
votes
2 answers

Unexpected long long value in C++

In my code I simply scan values of t, n and m respectively. While debugging I found that whatever value I give to m, it is taking the value 0. You can run this code for input : 1 3 4 Here, the output should be 4, but unexpectedly its 0. On the…
2
votes
3 answers

How to store 64 digits integer in C?

I am dealing with 2 64 digits integers and need to multiple these two numbers. When I tried to store it into a long long int variable, I got the following compiling error: 1.c: In function ‘main’: 1.c:5:6: warning: integer constant is too large…
Mark Dong
  • 59
  • 2
  • 8
1 2
3
8 9