2000-02-11 04:03:31 -08:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
2011-07-27 07:17:02 -07:00
|
|
|
/* OCaml */
|
2000-02-11 04:03:31 -08:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
2001-12-07 05:41:02 -08:00
|
|
|
/* under the terms of the GNU Library General Public License, with */
|
|
|
|
/* the special exception on linking described in file ../../LICENSE. */
|
2000-02-11 04:03:31 -08:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* Check for the availability of "long long" type as per ISO C9X */
|
|
|
|
|
2002-05-25 01:33:26 -07:00
|
|
|
/* Meaning of return code:
|
|
|
|
0 long long OK, printf with %ll
|
|
|
|
1 long long OK, printf with %q
|
|
|
|
2 long long OK, no printf
|
|
|
|
3 long long not suitable */
|
|
|
|
|
2000-02-11 04:03:31 -08:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
long long l;
|
|
|
|
unsigned long long u;
|
|
|
|
char buffer[64];
|
|
|
|
|
2002-05-25 01:33:26 -07:00
|
|
|
if (sizeof(long long) != 8) return 3;
|
2000-02-11 04:03:31 -08:00
|
|
|
l = 123456789123456789LL;
|
2002-05-25 01:33:26 -07:00
|
|
|
buffer[0] = '\0';
|
2000-02-11 04:03:31 -08:00
|
|
|
sprintf(buffer, "%lld", l);
|
2001-03-07 07:34:00 -08:00
|
|
|
if (strcmp(buffer, "123456789123456789") == 0) return 0;
|
|
|
|
/* the MacOS X library uses qd to format long longs */
|
|
|
|
buffer[0] = '\0';
|
|
|
|
sprintf (buffer, "%qd", l);
|
|
|
|
if (strcmp (buffer, "123456789123456789") == 0) return 1;
|
2002-05-25 01:33:26 -07:00
|
|
|
return 2;
|
2000-02-11 04:03:31 -08:00
|
|
|
}
|