C++ module ordering (was: segmentation fault on GiNaC-1.2.0 using MinGW on Win XP)

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Mon May 10 00:26:14 CEST 2004


On 9 May 2004, Gabriel Dos Reis wrote:
[...]
> | 1) Most professional C++ programmers are not aware of there being a
> |    problem.  Really.  :-(
>
> I think that is far too excessive.

Well, I suppose we can reach agreement by putting that attribute in
quotes.  ;-)

> | 2) Even if they are, they are unlikely to get it right.  #-(
> |
> | 3) If they don't get it right, debugging code which hasn't even started
> |    running yet is intersting.  :-/
>
> agreed too.

Of course such programs can be debugged the way Ian has described.  In
fact, you normally are able to obtain a stack backtrace which makes the
problem apparent.  (That is, unless you are completely clueless and the
debugging version is built differently and doesn't core as opposed to
the release version.  (Oops, we've just had this case in GiNaC the other
way round, haven't we?))

Let me mention that the dependency problem may be somewhat aggravated in
the situation where a stack of libraries sit on top of each other and
where static objects from the higher libs depend on properly initialized
static objects from the lower levels.  I suppose this could be done, too,
by the compiler?

<offtopic>
Anyway, that whole static domain is IMO somewhat uncared for in C++.
Which is unfortunate.  It does give other environments a real competitive
advantage.  Without claiming actual experience, I've frequently pondered
whether a class static section (of Java fame) wouldn't be quite useful.
Useful for things less mundane than establishing initialization orders, of
course.  But that is another story.
</offtopic>

Luck
   -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-devel mailing list