]> www.ginac.de Git - cln.git/blobdiff - include/cln/dfloat_class.h
Replace CL_REQUIRE/CL_PROVIDE(cl_DF_globals) with portable code.
[cln.git] / include / cln / dfloat_class.h
index f36f80fee0513e1f3fc2d283355f16a903e900d4..9d0b9c74e7f49e5108b7d1c06c944038d0b88412 100644 (file)
@@ -15,8 +15,8 @@ public:
 // Assignment operators.
        cl_DF& operator= (const cl_DF&);
 // Optimization of method pointer_p().
-       cl_boolean pointer_p() const
-               { return cl_true; }
+       bool pointer_p() const
+               { return true; }
 // Faster pointer_p() gives a faster copy constructor (but not destructor!!!).
        cl_DF (const cl_DF& x);
 // Constructors and assignment operators from C numeric types.
@@ -31,7 +31,7 @@ public:
        operator struct cl_heap_dfloat * () const;
 public:        // Ability to place an object at a given address.
        void* operator new (size_t size) { return malloc_hook(size); }
-       void* operator new (size_t size, cl_DF* ptr) { (void)size; return ptr; }
+       void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
        void operator delete (void* ptr) { free_hook(ptr); }
 private:
 // Friend declarations. They are for the compiler. Just ignore them.
@@ -52,7 +52,15 @@ inline cl_DF::operator struct cl_heap_dfloat * () const
 extern const cl_DF cl_DF_0;
 inline cl_DF::cl_DF ()
        : cl_F ((cl_private_thing) (struct cl_heap_dfloat *) cl_DF_0) {}
-CL_REQUIRE(cl_DF_globals)
+class cl_DF_globals_init_helper
+{
+       static int count;
+public:
+       cl_DF_globals_init_helper();
+       ~cl_DF_globals_init_helper();
+};
+static cl_DF_globals_init_helper cl_DF_globals_init_helper_instance;
+
 #if 0 // see cl_DF.h
 inline cl_DF::cl_DF (struct cl_heap_dfloat * ptr)
        : cl_F ((cl_private_thing) ptr) {}