[GiNaC-list] msvc support patch (Was: use of STL iterators in GiNaC)

Alexei Sheplyakov varg at metalica.kh.ua
Fri Apr 17 10:17:34 CEST 2009


On Thu, Apr 16, 2009 at 10:45:56PM +0100, Michael Goffioul wrote:
> On Thu, Apr 16, 2009 at 3:48 PM, Michael Goffioul
> <michael.goffioul at gmail.com> wrote:
> Here's the promised patch.

Thanks for a patch. Supporting more platforms/compilers  is certainly
a good thing as long as it doesn't break the code and doesn't introduce
subtle changes. Unfortunately your patch *does* introduce subtle changes
(and breaks compilation with any non-m$ compiler).

> Note that it is not intended to be applied as-is to ginac source tree.

Anyway, it would be nice if you avoid introducing the breakage and semantic
changes, or at least clearly mark them.

> But it's to show what are the required changes
> to make ginac compilable under VC++ and to be able to run the test
> suite.

diff -ur ginac-1.5.1/ginac/ncmul.cpp ginac-1.5.1-new/ginac/ncmul.cpp
--- ginac-1.5.1/ginac/ncmul.cpp 2009-02-17 13:39:22 +0000
+++ ginac-1.5.1-new/ginac/ncmul.cpp     2009-04-15 23:14:00 +0100
@@ -340,7 +340,7 @@
        // determine return types
        unsignedvector rettypes;
-       rettypes.reserve(assocseq.size());
+       rettypes.resize(assocseq.size());

I'm afraid this change breaks canonicalization of non-commutative products.

> Some comments about the patch:
> - the __alignof__ vs. __alignof could be turned into a configure test

The patch as is breaks compilation with any non-m$ compiler. That's
certainly not welcome.

> - VC++ does not support __func__ macro, so I changed it into __FILE__

Stripping debugging info is not welcome either. Please #ifdef _MSVC (or
whatever it is) these changes.

> - in exprseq.cpp, I had to add a dummy function to make VC++ instantiate
> expreseq::info(); don't know why...

Please #ifdef _MSVC that function. Also it would be nice to have a comment
in the source explaining why it's necessary (otherwise it's so tempting to
delete that pointless code). Other changes, like

diff -ur ginac-1.5.1/ginac/parser/parser.cpp ginac-1.5.1-new/ginac/parser/parser.cpp
--- ginac-1.5.1/ginac/parser/parser.cpp 2009-02-17 13:39:22 +0000
+++ ginac-1.5.1-new/ginac/parser/parser.cpp     2009-04-15 20:59:47 +0100
@@ -82,7 +82,7 @@

 extern numeric* _num_1_p;
-extern ex _ex0;
+extern const ex _ex0;

need such an #ifdef and a comment too.

Best regards,

(How) Did you manage to compile CLN with msvc?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20090417/9bdb9ca9/attachment-0001.sig>

More information about the GiNaC-list mailing list