const cl_LF operator- (const cl_LF& x, const cl_LF& y)
Hi, I find that the function ( const cl_LF operator- (const cl_LF& x, const cl_LF& y) ) in cl_LF.h and in cl_LF_2mimus.cc is different! In cl_LF.h: inline const cl_LF operator- (const cl_LF& x, const cl_LF& y) \ { \ return LF_LF_minus_LF(x,y); \ } In cl_LF_2mimus.cc : const cl_LF operator- (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_minus_LF,return) } } // namespace cln Is it wrong? And Why? Xinjian Zhao 2008-03-29 zhaoxinjian
Hi! zhaoxinjian wrote:
I find that the function ( const cl_LF operator- (const cl_LF& x, const cl_LF& y) ) in cl_LF.h and in cl_LF_2mimus.cc is different! In cl_LF.h: inline const cl_LF operator- (const cl_LF& x, const cl_LF& y) \ { \ return LF_LF_minus_LF(x,y); \ } In cl_LF_2mimus.cc : const cl_LF operator- (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_minus_LF,return) }
} // namespace cln Is it wrong? And Why?
It's not wrong. The first operator-() is part of a macro. It is an optimization, applicable as described in the comment above that macro. -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
Hello! On Sat, Mar 29, 2008 at 10:20:00PM +0100, Richard B. Kreckel wrote:
zhaoxinjian wrote:
I find that the function ( const cl_LF operator- (const cl_LF& x, const cl_LF& y) ) in cl_LF.h and in cl_LF_2mimus.cc is different! In cl_LF.h: inline const cl_LF operator- (const cl_LF& x, const cl_LF& y) \ { \ return LF_LF_minus_LF(x,y); \ } In cl_LF_2mimus.cc : const cl_LF operator- (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_minus_LF,return) }
} // namespace cln Is it wrong?
It is wrong.
And Why?
Because it declares the same function to be inline and non-inline, which violates the standard (7.1.2.4).
It's not wrong.
It *is* wrong, but [sometimes] it happens to work. Best regards, Alexei -- All science is either physics or stamp collecting.
Hello, Thanks. I wrote that letter in order to discuss this problem.And in CLN-1.2.0,I find many "bugs" like this. Alexei Sheplyakov wrote:
It *is* wrong, but [sometimes] it happens to work.
I think so. In my opinion,CLN will be modified with the development of compiler GCC.So I suggest that CLN be updated in standard C++. And this will also improve the possibility of migration from GCC to other Compilers. Best wishes, XinJian Zhao 2008-04-02 zhaoxinjian 发件人: Alexei Sheplyakov 发送时间: 2008-04-01 15:49:56 收件人: CLN discussion list 抄送: 主题: Re: [CLN-list] const cl_LF operator- (const cl_LF& x,const cl_LF& y) Hello! On Sat, Mar 29, 2008 at 10:20:00PM +0100, Richard B. Kreckel wrote:
zhaoxinjian wrote:
I find that the function ( const cl_LF operator- (const cl_LF& x, const cl_LF& y) ) in cl_LF.h and in cl_LF_2mimus.cc is different! In cl_LF.h: inline const cl_LF operator- (const cl_LF& x, const cl_LF& y) \ { \ return LF_LF_minus_LF(x,y); \ } In cl_LF_2mimus.cc : const cl_LF operator- (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_minus_LF,return) }
} // namespace cln Is it wrong?
It is wrong.
And Why?
Because it declares the same function to be inline and non-inline, which violates the standard (7.1.2.4).
It's not wrong.
It *is* wrong, but [sometimes] it happens to work. Best regards, Alexei -- All science is either physics or stamp collecting. _______________________________________________ CLN-list mailing list CLN-list@ginac.de https://www.cebix.net/mailman/listinfo/cln-list
zhaoxinjian wrote:
I wrote that letter in order to discuss this problem.And in CLN-1.2.0,I find many "bugs" like this.
As far as I can see, you still haven't explained what the "problem" actually is. Does it fail to compile or link? What's the diagnostic message, then? Could you, please, elaborate?
Alexei Sheplyakov wrote:
It *is* wrong, but [sometimes] it happens to work.
Ah, I understood the question as being skeptical about the diverging implementations. And in this respect, it is *not* wrong. Looking at it from the standard compliance perspective, though, I agree it's illegal.
I think so. In my opinion,CLN will be modified with the development of compiler GCC.So I suggest that CLN be updated in standard C++. And this will also improve the possibility of migration from GCC to other Compilers.
The thing is, that CLN will not be modified unless somebody a) writes a patch and/or b) explains how to find the bugs in a systematical way. See, it happens to work just fine on all machines I tried and I'm not at all inclined to read source code and check it for standard compliance line-by-line. Please, explain what's the matter, or, better, send us a patch. Best wishes -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
Hello Zhao,
I find that the function ( const cl_LF operator- (const cl_LF& x, const cl_LF& y) ) in cl_LF.h and in cl_LF_2mimus.cc is different! In cl_LF.h: inline const cl_LF operator- (const cl_LF& x, const cl_LF& y) \ { \ return LF_LF_minus_LF(x,y); \ }
This is part of a macro, ALL_cl_LF_OPERATIONS_SAME_PRECISION, which can only be used in particular circumstances. The comment in front of this macro says it.
In cl_LF_2mimus.cc : const cl_LF operator- (const cl_LF& x1, const cl_LF& x2) { GEN_LF_OP2(x1,x2,LF_LF_minus_LF,return) }
Do you have a problem with this? If so, can you show the complete error messages? Bruno
participants (4)
-
Alexei Sheplyakov
-
Bruno Haible
-
Richard B. Kreckel
-
zhaoxinjian