Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
DIV_OVERLOADS.cpp
Go to the documentation of this file.
1// checking for overloads of div()
2
3
25// determine whether the div() function (including
26// any overloads) is defined in the usual libc headers
27
28#include <math.h>
29#include <stdio.h>
30#include <stdlib.h>
31
32#include "config.h"
33
34#ifndef _RWSTD_NO_LONG_LONG
35# if defined _MSC_VER
36# define LONG_LONG __int64
37# else
38# define LONG_LONG long long
39# endif
40#endif // _RWSTD_NO_LONG_LONG
41
42
44
45template <class T>
46ldiv_t div (T, T)
47{
49
50 return ldiv_t ();
51}
52
53template <class T>
54void check_div (T t, const char *tname)
55{
56 template_used = 0;
57
58 div (t, t);
59
60 if (0 == template_used)
61 printf ("%s", "// ");
62
63 printf ("#define _RWSTD_NO_DIV_%s\n", tname);
64}
65
66int main ()
67{
68 check_div ((int)1, "INT");
69 check_div ((long)1, "LONG");
70
71#if defined (LONG_LONG)
72 check_div ((LONG_LONG)1, "LLONG");
73#endif // LONG_LONG
74
75 return 0;
76}
#define T
Definition 17.names.cpp:163
#define t
Definition 17.names.cpp:136
IMPORT_C SInt32 printf(const Char *,...)
void check_div(T t, const char *tname)
ldiv_t div(T, T)
int main()
#define LONG_LONG
int template_used