Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
ABS_OVERLOADS.cpp
Go to the documentation of this file.
1// checking for overloads of abs()
2
3
25// determine whether the abs() 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>
47{
49
50 return t;
51}
52
53template <class T>
54void check_abs (T t, const char *tname)
55{
56 template_used = 0;
57
58 abs (t);
59
60 if (0 == template_used)
61 printf ("%s", "// ");
62
63 printf ("#define _RWSTD_NO_ABS_%s\n", tname);
64}
65
66int main ()
67{
68 check_abs ((bool)0, "BOOL");
69 check_abs ((char)0, "CHAR");
70 check_abs ((signed char)0, "SCHAR");
71 check_abs ((unsigned char)0, "UCHAR");
72 check_abs ((short)0, "SHRT");
73 check_abs ((unsigned short)0, "USHRT");
74 check_abs ((int)0, "INT");
75 check_abs ((unsigned)0, "UINT");
76 check_abs ((long)0, "LONG");
77 check_abs ((unsigned long)0, "ULONG");
78
79#if defined (LONG_LONG)
80 check_abs ((LONG_LONG)0, "LLONG");
81 check_abs ((unsigned LONG_LONG)0, "ULLONG");
82#endif // LONG_LONG
83
84 return 0;
85}
#define T
Definition 17.names.cpp:163
#define t
Definition 17.names.cpp:136
T abs(T t)
void check_abs(T t, const char *tname)
int main()
#define LONG_LONG
int template_used
IMPORT_C SInt32 printf(const Char *,...)