[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cannot initialize static pointer class member in __attribute__ ((co
From: |
Paul Pluzhnikov |
Subject: |
Re: cannot initialize static pointer class member in __attribute__ ((constructor)) |
Date: |
Fri, 03 Oct 2008 15:33:35 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
jeremy barrett <jeremyb@gmail.com> writes:
>> Finally, it is entirely pointless to provide initAx() and initBx().
>> If you want to initialize A::x and B::x to some values, just do
>> so directly:
>
> Here's the point. A and B are very generic classes that are included
> in a number of different libraries I've built. So the static
> initializers set x to something suitably generic for use in standard
> cases.
Note that you likely will have unexpected interactions if A::x is
in more than one shared library, and is initialized to a different
value in each.
> In order keep data appropriately hidden (and save myself some
> bookkeeping), I add this constructor function to various of the shared
> libraries to initialize x to something meaningful (conceptual zero)
> for the given application/environment.
I still do not understand what the difficulty with simple assignment is.
Could you provide a simple example demonstrating the need for this
'constructor function' ?
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.