Date: Fri, 10 Aug 2001 20:48:39 -0400 From: Jan Knepper <jan@digitaldaemon.com> To: FreeBSD Hackers <hackers@freebsd.org> Subject: Re: the =+ operator Message-ID: <3B7480E7.6070406@digitaldaemon.com> References: <3B73F0BC.548D40B3@home.com> <3B73F595.CD12F8AA@mitre.org> <3B747B35.CCA4C6D1@home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--------------000401060602010107040906 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I just checked on this "=+" and "=-" with the guy that wrote the first native C++ compiler and he does not recall it at first being that way... I have been programming C++ myself for over 10 years and *never* heard this before. I do not know where it comes from. It might have been some mis-implemented C++ syntax in other C++ compilers (GNU?). Need less to say, '=+' as operator would be scary as it is too close to '= +' as in a=+5 or a=-5 for that matter. I have too much respect for Bjarne to think that he would have defined it as '=+' and '=-' in the beginning... Just my two cents. Jan Rob wrote: >Mike Smith wrote: > >>I've been doing this for a long time and today this would be taken as >>two operators. The assignment and unary +. Since A = B is the same as A >>= +B, it would perform the same as a simple assignment. The only reason >>I can see to do this legitimately is for clarity reasons, i.e., if what >>follows the "+" is almost always used as a negative but this use is an >>exception. But more likely, at some point there was something between >>the = and + at one point that got deleted, but the "+" was left. Since >>this is "the default", there would be no coding or operational errors >>from leaving it in. >> >>Then again, it could have been intended to be += and you've found a >>heretofore undiscovered bug! All you have to do is press Shift at the >>wrong time (not that I've ever done that). >> >>Mike Smith >>(but not "THE" Mike Smith) >> >>Rob wrote: >> >>>My first post on hackers, so please don't flame me too bad :) I think >>>that only an old hacker can give me the answer :) >>> >>>I've searched far and wide on search engines to find out what the =+ >>>operator does, to no avail. I'm porting some old code and found it. I >>>made a test program and compiled it with gcc, and all it appears to do >>>is the same as regular assignment. But I'm wondering if in some day >>>long ago, it mean't something else? Thanks, Rob. >>> >>>To Unsubscribe: send mail to majordomo@FreeBSD.org >>>with "unsubscribe freebsd-hackers" in the body of the message >>> > >Thanks Mike, also thanks for everyone elses response. This code is >actually pretty new. It part of a bi-gradient conjugate solver for FEM >simulators. I compiled the original code with gcc, so I'm assuming it >just treated =+ as an =. But just for kicks I also tried +=. In any >case I have some other bugs in it that I have to track down since >no-matter which way I tried the assignment, my solutions fail to >converge :( Rob. > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-hackers" in the body of the message > > --------------000401060602010107040906 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <html> <head> </head> <body> I just checked on this "=+" and "=-" with the guy that wrote the first native C++ compiler and he does not recall it at first being that way... I have been programming C++ myself for over 10 years and *never* heard this before. I do not know where it comes from. It might have been some mis-implemented C++ syntax in other C++ compilers (GNU?). Need less to say, '=+' as operator would be scary as it is too close to '= +' as in a=+5 or a=-5 for that matter. I have too much respect for Bjarne to think that he would have defined it as '=+' and '=-' in the beginning...<br> <br> Just my two cents.<br> Jan<br> <br> <br> <br> Rob wrote:<br> <blockquote type="cite" cite="mid:3B747B35.CCA4C6D1@home.com"> <pre wrap="">Mike Smith wrote:<br></pre> <blockquote type="cite"> <pre wrap="">I've been doing this for a long time and today this would be taken as<br>two operators. The assignment and unary +. Since A = B is the same as A<br>= +B, it would perform the same as a simple assignment. The only reason<br>I can see to do this legitimately is for clarity reasons, i.e., if what<br>follows the "+" is almost always used as a negative but this use is an<br>exception. But more likely, at some point there was something between<br>the = and + at one point that got deleted, but the "+" was left. Since<br>this is "the default", there would be no coding or operational errors<br>from leaving it in.<br><br>Then again, it could have been intended to be += and you've found a<br>heretofore undiscovered bug! All you have to do is press Shift at the<br>wrong time (not that I've ever done that).<br><br>Mike Smith<br>(but not "THE" Mike Smith)<br><br>Rob wrote:<br></pre> <blockquote type="cite"> <pre wrap="">My first post on hackers, so please don't flame me too bad :) I think<br>that only an old hacker can give me the answer :)<br><br>I've searched far and wide on search engines to find out what the =+<br>operator does, to no avail. I'm porting some old code and found it. I<br>made a test program and compiled it with gcc, and all it appears to do<br>is the same as regular assignment. But I'm wondering if in some day<br>long ago, it mean't something else? Thanks, Rob.<br><br>To Unsubscribe: send mail to <a class="moz-txt-link-abbreviated" href="mailto:majordomo@FreeBSD.org">majordomo@FreeBSD.org</a><br>with "unsubscribe freebsd-hackers" in the body of the message<br></pre> </blockquote> </blockquote> <pre wrap=""><!----><br>Thanks Mike, also thanks for everyone elses response. This code is<br>actually pretty new. It part of a bi-gradient conjugate solver for FEM<br>simulators. I compiled the original code with gcc, so I'm assuming it<br>just treated =+ as an =. But just for kicks I also tried +=. In any<br>case I have some other bugs in it that I have to track down since<br>no-matter which way I tried the assignment, my solutions fail to<br>converge :( Rob.<br><br>To Unsubscribe: send mail to <a class="moz-txt-link-abbreviated" href="mailto:majordomo@FreeBSD.org">majordomo@FreeBSD.org</a><br>with "unsubscribe freebsd-hackers" in the body of the message<br><br><br></pre> </blockquote> <br> </body> </html> --------------000401060602010107040906-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B7480E7.6070406>