Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
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
43
int
template_used
;
44
45
template
<
class
T>
46
ldiv_t
div
(
T
,
T
)
47
{
48
++
template_used
;
49
50
return
ldiv_t ();
51
}
52
53
template
<
class
T>
54
void
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
66
int
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
}
T
#define T
Definition
17.names.cpp:163
t
#define t
Definition
17.names.cpp:136
printf
IMPORT_C SInt32 printf(const Char *,...)
check_div
void check_div(T t, const char *tname)
Definition
DIV_OVERLOADS.cpp:54
div
ldiv_t div(T, T)
Definition
DIV_OVERLOADS.cpp:46
main
int main()
Definition
DIV_OVERLOADS.cpp:66
LONG_LONG
#define LONG_LONG
Definition
DIV_OVERLOADS.cpp:38
template_used
int template_used
Definition
DIV_OVERLOADS.cpp:43
math.h
stdio.h
stdlib.h
Generated by
1.9.8