Mail Archives: djgpp-workers/2001/02/07/18:30:49
This is the stddef.h patch.
The only complication here is that 'offsetof' needs a different
definition in C++ (using std::size_t instead of size_t).
This could be avoided by taking advantage of the fact that
'size_t' means 'unsigned long', but I assumed that wasn't a
good idea.
Stephen
*** include/stddef.h.old Tue Dec 5 14:05:54 2000
--- include/stddef.h Mon Feb 5 18:31:30 2001
***************
*** 4,7 ****
--- 4,8 ----
#ifdef __cplusplus
+ namespace std {
extern "C" {
#endif
***************
*** 10,14 ****
--- 11,19 ----
#define NULL 0
+ #ifdef __cplusplus
+ #define offsetof(s_type, mbr) ((std::size_t) &((s_type *)0)->mbr)
+ #else
#define offsetof(s_type, mbr) ((size_t) &((s_type *)0)->mbr)
+ #endif
#ifndef _PTRDIFF_T
***************
*** 42,46 ****
--- 47,62 ----
#ifdef __cplusplus
}
+ }
#endif
#endif /* !__dj_include_stddef_h_ */
+
+
+ #if defined(__cplusplus)
+ #ifndef __dj_via_cplusplus_header_
+
+ using std::ptrdiff_t;
+ using std::size_t;
+
+ #endif /* !__dj_via_cplusplus_header_ */
+ #endif /* __cplusplus */
- Raw text -