giac development, vla and msvc
Publié : jeu. oct. 26, 2017 3:35 pm
I am slowly trying to look at possibilities to compile giac in visual studio (which I was hoping to do a very long time already).
What I noticed though is that the giac code has been written in a very non-uniform way. There are places in the code where there are heavy use of VLA (variable length arrays) and there are places where the traditional "new" and "delete" are used to allocate such arrays (this can be seen in a lot of places in vecteur.cc and this is more so when pthread is enabled). Unfortunately, VLA is not supported by MSVC and probably will not be in the near future:
https://msdn.microsoft.com/en-us/library/zb1574zs.aspx
So aside from gmp (where mpir gives hope) there are other hurdles for compiling giac in MSVC. And I cannot see any other easy way to compile giac than to fork the code and try to convert the C99 VLA to traditional new and delete. This is my line of action right now. Just out of curiousity though, has anyone been able to successfully compile giac in MSVC? If not, this is what I will try for now and try to report the progress ocassionally in this forum.
There is another thing that caught my attention when trying to read the code. I am looking at vecteur.cc and I see a lot of similar code lines (and these are not just one or two lines) repeated several times. There is still good room for code optimization here (e.g. to call a procedure that execute these lines than to just write them all the time). I don't dare to change the code a lot because I can introduce a lot of bug. So my initial objective is just to first successfully compile in MSVC before trying any code optimization.
What I noticed though is that the giac code has been written in a very non-uniform way. There are places in the code where there are heavy use of VLA (variable length arrays) and there are places where the traditional "new" and "delete" are used to allocate such arrays (this can be seen in a lot of places in vecteur.cc and this is more so when pthread is enabled). Unfortunately, VLA is not supported by MSVC and probably will not be in the near future:
https://msdn.microsoft.com/en-us/library/zb1574zs.aspx
So aside from gmp (where mpir gives hope) there are other hurdles for compiling giac in MSVC. And I cannot see any other easy way to compile giac than to fork the code and try to convert the C99 VLA to traditional new and delete. This is my line of action right now. Just out of curiousity though, has anyone been able to successfully compile giac in MSVC? If not, this is what I will try for now and try to report the progress ocassionally in this forum.
There is another thing that caught my attention when trying to read the code. I am looking at vecteur.cc and I see a lot of similar code lines (and these are not just one or two lines) repeated several times. There is still good room for code optimization here (e.g. to call a procedure that execute these lines than to just write them all the time). I don't dare to change the code a lot because I can introduce a lot of bug. So my initial objective is just to first successfully compile in MSVC before trying any code optimization.