Missing namespace qualification in GiNaC 1.0.12
It seems the patch below was not included in 1.0.12. Was the problem fixed in a different way? All the best Roberto -- Prof. Roberto Bagnara Computer Science Group Department of Mathematics, University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it diff -c -d -r1.1.1.1 function.h *** ginac/function.h 29 Sep 2002 13:26:57 -0000 1.1.1.1 --- ginac/function.h 29 Sep 2002 14:02:48 -0000 *************** *** 416,422 **** } #define is_ex_the_function(OBJ, FUNCNAME) \ ! (GiNaC::is_exactly_a<GiNaC::function>(OBJ) && GiNaC::ex_to<GiNaC::function>(OBJ).get_serial() == function_index_##FUNCNAME) } // namespace GiNaC --- 416,422 ---- } #define is_ex_the_function(OBJ, FUNCNAME) \ ! (GiNaC::is_exactly_a<GiNaC::function>(OBJ) && GiNaC::ex_to<GiNaC::function>(OBJ).get_serial() == GiNaC::function_index_##FUNCNAME) } // namespace GiNaC
Hi! On Wed, Oct 30, 2002 at 06:15:53PM +0100, Roberto Bagnara wrote:
It seems the patch below was not included in 1.0.12.
#define is_ex_the_function(OBJ, FUNCNAME) \ ! (GiNaC::is_exactly_a<GiNaC::function>(OBJ) && GiNaC::ex_to<GiNaC::function>(OBJ).get_serial() == function_index_##FUNCNAME)
#define is_ex_the_function(OBJ, FUNCNAME) \ ! (GiNaC::is_exactly_a<GiNaC::function>(OBJ) && GiNaC::ex_to<GiNaC::function>(OBJ).get_serial() == GiNaC::function_index_##FUNCNAME)
The function_index_* are not necessarily in the GiNaC namespace (only for functions defined by GiNaC itself), so this patch would break is_ex_the_function() for user-defined functions. Forcing function_index_* into the GiNaC namespace doesn't seem to be possible in C++. I can't think of any solution that wouldn't break binary compatibility. In GiNaC 1.1, the situation is slightly improved: the function_index_* are replaced by *_SERIAL classes which at least allows you to prefix the function name with a namespace qualifier when using is_ex_the_function(). The ideal solution would be to convert is_ex_the_function() into a proper template function (a la is_a<>() etc.), but this would require having classes with the same identifier as functions (e.g. "class sin" which in some way holds the serial number, and "sin()" which constructs a function object) which also doesn't appear to be possible (well, gcc 3.x didn't accept it...). If you have any clever solution for this, I'd be happy to hear it. Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
Roberto Bagnara