Hi, here is a simple one correcting some unclear code (at least from the point of view of the pedantic MSVC compiler). 1. Added const because the original declaration in the header file also has it 2. Added double to resolve ambiguities in which log() function is meant With this patch and the two others I sent earlier CLN compiles with MSVC and all tests pass successfully. Jan
Hi Jan! On 03/13/2011 08:39 AM, Jan wrote:
here is a simple one correcting some unclear code (at least from the point of view of the pedantic MSVC compiler).
1. Added const because the original declaration in the header file also has it
This is obviously correct and should be applied right away. I'll do so shortly. Thanks.
2. Added double to resolve ambiguities in which log() function is meant
Same here.
With this patch and the two others I sent earlier CLN compiles with MSVC and all tests pass successfully.
Great! What version of MSVC are you using? With regard to your other patches, these look like obscure workarounds. Pardon me, but fixing bugs in CLN without reporting the problem to the compiler manufacturer is just wrong IMHO. Have you tried submitting a bug report? If I am not mistaken, there are three issues: 1) Why does declaring a symbol extern "C" within a namespace result in another symbol than when it's declared outside the namespace? 2) Why have to qualify cl_I_constructor_from_UL() with cln:: in code clearly inside the namespace cln? 3) Why can't we declare an extern function within an inline function where it's needed? Assuming the answer to all three questions is "it's a bug in MSVC", please help improve the state of software at the right place: *) Write bug reports! <http://connect.microsoft.com/VisualStudio> should be the right place, I suppose. Hopefully, MS will fix them some day. *) Work around the bugs in CLN using #if _MSC_VER preprocessor symbols in order to document it as a workaround. I'll accept such a patch if you send me one. Best wishes -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
Hello Richard,
With this patch and the two others I sent earlier CLN compiles with MSVC and all tests pass successfully.
Great! What version of MSVC are you using? Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
That is the latest freely available version from Visual Studio Express 2010.
1) Why does declaring a symbol extern "C" within a namespace result in another symbol than when it's declared outside the namespace? We are not declaring extern "C" but just extern. And actually it is being declared inside the namespace both times. The real problem is related to your question 3) see below.
2) Why have to qualify cl_I_constructor_from_UL() with cln:: in code clearly inside the namespace cln? You are right, it is not necessary (which doesn't make the problem less obscure, though).
3) Why can't we declare an extern function within an inline function where it's needed? Because MSVC doesn't tag the extern function with the cln:: namespace in this case. In other words, if I declare
namespace cln { extern unsigned f(); } the symbol is cln::f If I define the function namespace cln { unsigned f() {} } the symbol is also cln::f But if I declare namespace cln { inline g() { extern f(); } } the symbol is just f in the global namespace.
Assuming the answer to all three questions is "it's a bug in MSVC" Can someone with knowledge of the standard answer that question?
*) Work around the bugs in CLN using #if _MSC_VER preprocessor symbols in order to document it as a workaround. See attached file.
Thanks, Jan
participants (2)
-
Jan
-
Richard B. Kreckel