[GiNaC-list] Include Guards
Jason Dusek
jason.dusek at gmail.com
Wed Jan 19 22:57:03 CET 2005
In the FAQ, they discuss a problem with multiple inclusions of a
header where global symbols are defined:
================================================
Q: I have various modules, some global variables and...
A: ...and you are getting weird results with symbols not being
identical? Imagine this situation: A file globals.h declares symbol
x("x"). Two other modules #include "globals.h", do something with
symbol x and return an expression ex containing the symbol to the
caller (e.g. to main()). When the caller combines the two expressions
there are really two different symbols both with the same print-name
x. This may cause terms like x-x to stay around which will never be
simplified to 0 because the system has no knowledge that the two
symbols are supposed to be the same. How should it? After all the
declarations really happend in different compilation units!
================================================
Can include guards solve this problem? Do I *have* to make that evil
factory initializer thingy?
--
_jason
More information about the GiNaC-list
mailing list