|
From C standard, int has of at least 16bit, long has of at least 32bit and at least 64bit for long long if any (some platforms may not support). Just wondering if the sentence as title is always true.
Thanks.
Started by c-stranger on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Of course, this would be silly <= int <= long
Still searching for long....
Across an implementation in which sizeof(int) > sizeof(long) you have my permission to give, if CHAR_BITS == 8), while long is 32-bits (4 bytes).
|
|
I have a byte array that has hex values and I initially put those values in a unsigned long. I am using a 32 bit processor via Ubuntu at the moment. But, i might have to port this program to a 64 bit processor.
now I am aware of strtoul function but since...
Answer Snippets (Read the full thread at stackoverflow):
Instead of using long or long long you should use a typedef like uint32_t , or something similar}; long* p_long = reinterpret_cast<long*>(bytes); std::cout << std::hex << *p_long if they....
|
|
Title basically says it all... does GCC support:
long long int
which would be a 64 bit integer?
Also, is long long int part of the standard? Thanks
Started by Polaris878 on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
The standard does not mandate that usually an unsigned ... .
Yes GCC does support long long int , which is a part of C99 standard.
And now I can prove it.
long long int is a part of the C99 standard, and I know GCC supports it.
|
Ask your Facebook Friends
|
Why might using a "long long" in C or C++ be a bad thing?
I was compiling a runtime library the other day and in the code it checks to see if longs are 64bits and if not it uses a long long. But along with that, it sends out a #warning "using long long...
Started by Crazy Chenz on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If you use an old C compiler, it might not support long long that led to size_....
Two reasons:
You don't know how long (haha!) a long long is, so if the code assumes that it is exactly 64 bits, there could be a problem.
|
|
Can anyone explain the output of this program and how I can fix it?
unsigned long long ns = strtoull("123110724001300", (char **)NULL, 10); fprintf(stderr, "%llu\n", ns); // 18446744073490980372
Answer Snippets (Read the full thread at stackoverflow):
However main(void) { unsigned long long ns = strtoull("123110724001300", NULL, 10); fprintf(stderr, "%llu\n> int main(void) { unsigned....
Why not use strtoull if you want an unsigned long long?
I cannot explain the behavior.
|
|
How can I do that? What's the format specifier?
For example, I have:
long long veryLong = // assume value here NSLog(@"%f", veryLong); // of course wrong...
Started by openfrog on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
long long veryLong = // assume value here NSLog(@"My long long is: %lld", veryLong); // now it's right.
Format method will automatically do the right thing if you just use %@ .
|
|
Hi guys,
to do a proper Linux/unix styled application, what is the best choice (eg. afaik ls uses getopt_long but for example ffmpeg getopt_long_only). Which one do you recommend?
Cheers,
Started by Emanem on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
I've never used getopt_long_only, but it seems like it would have to do more lookups, as it has to look at both the long and short options if an unknown flag starts with a single - :
If an option....
User either argp_parse or libpopt.
Neither.
|
|
Hello,
If i want to use something like below in a C code:
if(num < 0x1 LL)
I want the comparison to happen on a long long constant, but suffix LL doesn't work in MSVC6.0 , but it works in MS Visual Studio 2005.
How can i get it working in MSVC 6.0?...
Started by goldenmean on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Visual C 6.0 was released....
12i64 )
The long long type was standardized in the 1999 ISO.
For example, have a look at this discussion thread 6.0 to check, but does i64 work? (e.g .
AFAIK, long long isn't supported in MSVC 6.0.
|
|
Hi, I have a program where i simply copy a byte array into a long long array. There are a total of 20 bytes and so I just needed a long long of 3. The reason I copied the bytes into a long long was to make it portable on 64bit systems.
I just need to ...
Answer Snippets (Read the full thread at stackoverflow):
In your case, casting the byte array to a long long * actually creates a potential.
Of the processor.
|
|
I'm trying to implement George Marsaglia's Complementary Multiply-With-Carry algorithm in C. It seems to work great under Win7 64 bit and Linux 32 bit, but seems to behave strangely under Win 7 32 bit. The random number it returns is 32 bit, but there...
Started by mingos on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The type long long) :
— maximum value for an object of type unsigned long long int
ULLONG_MAX 18446744073709551615 // 2**64.
If your compiler has stdint.h I would suggest using uint64_t instead .
|