Prev: System Calls
Next: Warning to newbies
From: Jonathan de Boyne Pollard on 18 Mar 2010 02:48 > >>>> >>>> Such edicts make one want to write code in the form >>>> x /* The variable x */ >>>> = /* is assigned */ >>>> x /* its value * / >>>> + /* plus * / >>>> 2 /* one */ >>>> ; /* . */ >>>> >>> It also shows that maintaining these kinds of comment are more >>> trouble than the comment is worth. The maintenance of these >>> comments is way higher than the information they give, i.e. Who >>> forgot to change the '/* one */' to '/* two */'? >>> >> x /* The pointer */ >> -> /* equals */ >> x /* itself */ >> = /* minus */ >> 2 /* five */ >> ; /* :( */ >> > Then you start questioning which is right, the comment or the code, > which can end up leading to a lot more work to figure it out. > As has been finally spotted, there was a subtler point in there, too.
From: Kenny McCormack on 18 Mar 2010 03:38 In article <IU.D20100318.T064845.P11663.Q2(a)J.de.Boyne.Pollard.localhost>, Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups(a)NTLWorld.COM> wrote: .... >As has been finally spotted, there was a subtler point in there, too. We could play the "Who subtler now?" game until the cows come home. The point I was making was that that's what we do in CLC. The standard CLC thing is to pounce upon something stupid, like the upper/lower case thing, and totally ignore real issues. It's the whole "prototyping main()" thing, that we do so well. -- (This discussion group is about C, ...) Wrong. It is only OCCASIONALLY a discussion group about C; mostly, like most "discussion" groups, it is off-topic Rorsharch revelations of the childhood traumas of the participants...
From: Nick Keighley on 18 Mar 2010 03:49 On 17 Mar, 15:33, Keith Thompson <ks...(a)mib.org> wrote: > "jackassp...(a)gmail.com" <jackassp...(a)gmail.com> writes: > >> > What *is* it written in? > > >> [...] > > >> I don't recognize the language, but it was originally posted only > >> to alt.folklore.computers. Somebody decided to add a cross-post > >> to comp.programming and comp.lang.c and didn't bother to mention it. > > > pascal uses := as an assignment operator > > But it doesn't use ; to introduce a comment. > > Of course, the code could have been incorrect. scheme uses ; as a comment- but of course doesn't look anything like the above
From: Jonathan de Boyne Pollard on 18 Mar 2010 03:46 > >> >> Such edicts make one want to write code in the form >> >> x /* The variable x */ >> = /* is assigned */ >> x /* its value * / >> + /* plus * / >> 2 /* one */ >> ; /* . */ >> > This sort of thing is one of the strongest arguments for *always* > editing and viewing code in an editor with syntax highlighting for the > source language. The problem and the reason why the compiler would > accept the code both become glaringly obvious. > That's a good point. And there's more of it. Had I posted this to several places other than Usenet, that syntax colouring would have been right there in the posting itself. Had I written it, for example, on a MediaWiki wiki (with the appropriate extensions), simply placing the code within a <syntaxhighlight> HTML element (with the language set to C or C++) would have revealed the problem. One can envisage a future extension to HTML where the <code> element causes browser-side syntax colouring. There are already places where it causes server-side syntax colouring. Stack Overflow is one such. Again, had I posted the snippet in a Stack Overflow Q&A thread, within a <code> element, it would have been automatically coloured, showing the extent of the comment. A text/plain bodypart in a Usenet posting doesn't have such a capability, of course. We're probably all aware of the extra problems that posting to Usenet introduces into code, including posting mechanisms that introduce mandatory line wrap, some of which (Step forward, Google Groups.) not only provide no mechanism for inhibiting line wrapping but don't even let the poster know ahead of time where the line wrapping will actually be, which can play havoc with "C++-style" comments. This is a case of posting to Usenet helping to make a problem more difficult to spot than it would be in (some) editors, on (some) wikis, and on some WWW programming discussion fora.
From: Ahem A Rivet's Shot on 18 Mar 2010 03:47
On Wed, 17 Mar 2010 07:14:43 -0700 Patricia Shanahan <pats(a)acm.org> wrote: > Ahem A Rivet's Shot wrote: > > On Wed, 17 Mar 2010 07:03:43 -0500 > > jmfbahciv <jmfbahciv(a)aol> wrote: > > > >> Jonathan de Boyne Pollard wrote: > > > >>> Such edicts make one want to write code in the form > >>> > >>> x /* The variable x */ > >>> = /* is assigned */ > >>> x /* its value * / > >>> + /* plus * / > >>> 2 /* one */ > >>> ; /* . */ > >>> > >> And would make all tapes spill over to two magtapes. > >> > >> Fortunately, your code would produce many detected errors. > > > > Nope that's perfectly valid C code - provided that x is > > declared in scope. > > > > This sort of thing is one of the strongest arguments for *always* > editing and viewing code in an editor with syntax highlighting for the > source language. I do. > The problem and the reason why the compiler would > accept the code both become glaringly obvious. The spaces between the * and / in two carefully selected spaces ? They're not problems they're part of the charm of the example. -- Steve O'Hara-Smith | Directable Mirror Arrays C:>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/ |