Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / config / auto-aux / longlong.c
blobbcdf4c974ba56d987e4b80c0790d87a9d28282f2
1 /***********************************************************************/
2 /* */
3 /* Objective Caml */
4 /* */
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
6 /* */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../../LICENSE. */
11 /* */
12 /***********************************************************************/
14 /* $Id$ */
16 #include <stdio.h>
17 #include <string.h>
19 /* Check for the availability of "long long" type as per ISO C9X */
21 /* Meaning of return code:
22 0 long long OK, printf with %ll
23 1 long long OK, printf with %q
24 2 long long OK, no printf
25 3 long long not suitable */
27 int main(int argc, char **argv)
29 long long l;
30 unsigned long long u;
31 char buffer[64];
33 if (sizeof(long long) != 8) return 3;
34 l = 123456789123456789LL;
35 buffer[0] = '\0';
36 sprintf(buffer, "%lld", l);
37 if (strcmp(buffer, "123456789123456789") == 0) return 0;
38 /* the MacOS X library uses qd to format long longs */
39 buffer[0] = '\0';
40 sprintf (buffer, "%qd", l);
41 if (strcmp (buffer, "123456789123456789") == 0) return 1;
42 return 2;