public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* int64_t == long long
@ 2008-07-01 19:18 Yang Zhang
  2008-07-01 19:33 ` John Love-Jensen
  0 siblings, 1 reply; 11+ messages in thread
From: Yang Zhang @ 2008-07-01 19:18 UTC (permalink / raw)
  To: gcc-help

Hi, why isn't int64_t == long long at least on 64-bit x86 Linux?

http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Long-Long.html

says that these are *at least* 64 bits.  How do I tell what type this 
actually is?  And are literals ending with LL always long long?

Thanks in advance for any answers!



$ uname -a
Linux yang-xps410 2.6.24-19-generic #1 SMP Wed Jun 18 14:15:37 UTC 2008 
x86_64 GNU/Linux

$ cat longlongint.cc
#include <iostream>
#include <string>

using namespace std;

void f(int64_t x) { cout << x << endl; }
void f(int32_t x) { cout << x << endl; }
void f(int16_t x) { cout << x << endl; }
void f(int8_t  x) { cout << x << endl; }
void f(double  x) { cout << x << endl; }
void f(float   x) { cout << x << endl; }
void f(string& x) { cout << x << endl; }

int
main()
{
   long long int x = 32;
   f(x);
   int64_t y = 32;
   f(y);
   f(0LL);
   return 0;
}

$ g++ -pedantic -Wall -Wextra longlongint.cc
longlongint.cc:21:5: warning: use of C99 long long integer constant
longlongint.cc: In function âint main()â:
longlongint.cc:17: error: ISO C++ does not support âlong longâ
longlongint.cc:18: error: call of overloaded âf(long long int&)â is 
ambiguous
longlongint.cc:6: note: candidates are: void f(int64_t)
longlongint.cc:7: note:                 void f(int32_t)
longlongint.cc:8: note:                 void f(int16_t)
longlongint.cc:9: note:                 void f(int8_t)
longlongint.cc:10: note:                 void f(double)
longlongint.cc:11: note:                 void f(float)
longlongint.cc:21: error: call of overloaded âf(long long int)â is ambiguous
longlongint.cc:6: note: candidates are: void f(int64_t)
longlongint.cc:7: note:                 void f(int32_t)
longlongint.cc:8: note:                 void f(int16_t)
longlongint.cc:9: note:                 void f(int8_t)
longlongint.cc:10: note:                 void f(double)
longlongint.cc:11: note:                 void f(float)

-- 
Yang Zhang
http://www.mit.edu/~y_z/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-07-16 11:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-01 19:18 int64_t == long long Yang Zhang
2008-07-01 19:33 ` John Love-Jensen
2008-07-01 20:02   ` Yang Zhang
2008-07-01 20:19     ` Wesley Smith
2008-07-01 20:26       ` Yang Zhang
2008-07-01 23:47     ` John Love-Jensen
2008-07-02  4:50       ` Yang Zhang
2008-07-02  5:09         ` John Love-Jensen
2008-07-02  5:30           ` Yang Zhang
2008-07-16 20:37         ` Philipp Thomas
2008-07-16  0:31   ` Yang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).