Prev: integer
Next: shared memory question
From: Chip Eastham on 4 Mar 2010 16:33 On Mar 4, 3:32 pm, Jonathan de Boyne Pollard <J.deBoynePollard- newsgro...(a)NTLWorld.COM> wrote: > > But this really only means that average people well-versed in > > mathematics shouldn't attempt to code in C because they will likely > > make basic errors other people wouldn't. > > I'm sure that they'll be delighted to hear that it's their fault for > being mathematicians, and not the C language's fault. We mathematicians claim as a birth right to make the same basic errors in all programming languages! --c
From: Ike Naar on 4 Mar 2010 17:54 In article <4b8fc2ce$0$22943$e4fe514c(a)news.xs4all.nl>, Casper H.S. Dik <Casper.Dik(a)Sun.COM> wrote: >Vladimir Jovic <vladaspams(a)gmail.com> writes: > >>Yes, you missed the point. I prefer this way : > >>if ( NULL != pointer1 && >> 0x152 == pointer1->field7 ) >> { >> return; >> } > >But it makes the code much more difficult to read. > >You're not testing that NULL now has a different value or that >0x152 has a different value. The != operator is symmetric, ``NULL != pointer'' and ``pointer != NULL'' mean exactly the same thing, and both expressions are easy to read. You are not testing if the left operand now has a different value, you are testing if the left and the right operand have different values.
From: Ike Naar on 4 Mar 2010 18:08 In article <oct467-nu6.ln1(a)news.eternal-september.org>, Richard <rgrdev_(a)gmail.com> wrote: >> >> Yes, you missed the point. I prefer this way : >> >> if ( NULL != pointer1 && >> 0x152 == pointer1->field7 ) >> { >> return; >> } >> >> Can save you some debugging time :) > >I congratulate you : it has everything that sucks in pseudo styling. > >1) unnecessary waste of vertical screen usage Who cares; use your scroll button. >2) horrible "Non english" comparisons. It's also "non chinese" and "non swahili". It's C, and in C the order of the operands of the == and != operators is irrelevant. You don't read arithmetic expressions like you read a work of literature. >When discussing vars in computing it is normal to discuss the variables >b name. > >You dont say "if pi is larger than p".You say "if p is larger than >pi". No. The two statements do not have the same meaning. I think you mean "if pi is larger than p" vs. "if p is less than pi". If you have trouble understanding ``pi > p'' then perhaps you shouldn't be programming. >You're style is nothing more than fancy for fancy's sake IMO. Of course; so is your style (and so is mine).
From: Ike Naar on 4 Mar 2010 18:20 In article <87vddcdp8o.fsf(a)fever.mssgmbh.com>, Rainer Weikusat <rweikusat(a)mssgmbh.com> wrote: >John Gordon <gordon(a)panix.com> writes: >It is a bad idea to try to solve social problems with technical >means. The problem behind this is that = in C is a so-called 'false >cognate' for people who are intimately familiar with mathematics, that >is, a term in a foreign language which 'looks' very similar to a >loosely related term in one's mother tongue, but with a (subtly) >different meaning. This means that such people will likely confuse = >and == in C intuitively and have a hard time spotting such an error >since the text 'looks right' according to the set of conventions they >are so used to that they no longer actively think about them. > >But this really only means that average people well-versed in >mathematics shouldn't attempt to code in C because they will likely >make basic errors other people wouldn't. Using ``='' for something other than equality was, in my opinion, the most unfortunate design decision in the design of C. We should be glad that the language designers left it at that, and did not use ``+'' for ``or'', and ``++'' for addition ;-)
From: Seebs on 4 Mar 2010 18:59
On 2010-03-04, Chip Eastham <hardmath(a)gmail.com> wrote: > We mathematicians claim as a birth right > to make the same basic errors in all > programming languages! I'm not sure which ending fits better: .... bringing a whole new meaning to the phrase "without loss of generality". .... thus reducing everything to a class of problems already solved. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! |