Prev: System Calls
Next: Warning to newbies
From: Nick Keighley on 18 Mar 2010 09:46 On 18 Mar, 13:19, jmfbahciv <jmfbahciv(a)aol> wrote: > spinoza1111 wrote: > > On Mar 17, 2:13 am, gaze...(a)shell.xmission.com (Kenny McCormack) > >> In article <IU.D20100316.T165150.P1185...(a)J.de.Boyne.Pollard.localhost>, > >> Jonathan de Boyne Pollard <J.deBoynePollard-newsgro...(a)NTLWorld.COM> wrote: > >>> Such edicts make one want to write code in the form > >>> x /* The variable x */ > >>> = /* is assigned */ > >>> x /* its value * / > >>> + /* plus * / > >>> 2 /* two */ > >>> ; /* . */ > > > Nothing wrong with this style of commenting in assembler, at all. And, > > this code sample looks like the one byte per instruction language > > <snip> > > Are you nuts? yes, check his posting history
From: Charlie Gibbs on 18 Mar 2010 12:58 In article <hnt5bs22t2v(a)news4.newsguy.com>, jmfbahciv(a)aol (jmfbahciv) writes: > <grin> My language is MACRO-10. JMF was always tickled whenever > he assembled some code because MACRO would report a "successful" > assembly with the comment "No errors detected". Think about it. ;-) "As far as we know, the system has never had an undetected error." -- /~\ cgibbs(a)kltpzyxm.invalid (Charlie Gibbs) \ / I'm really at ac.dekanfrus if you read it the right way. X Top-posted messages will probably be ignored. See RFC1855. / \ HTML will DEFINITELY be ignored. Join the ASCII ribbon campaign!
From: Walter Bushell on 18 Mar 2010 12:40 In article <601.764T2654T5385823(a)kltpzyxm.invalid>, "Charlie Gibbs" <cgibbs(a)kltpzyxm.invalid> wrote: > In article <hnt5bs22t2v(a)news4.newsguy.com>, jmfbahciv(a)aol (jmfbahciv) > writes: > > > <grin> My language is MACRO-10. JMF was always tickled whenever > > he assembled some code because MACRO would report a "successful" > > assembly with the comment "No errors detected". Think about it. ;-) > > "As far as we know, the system has never had an undetected error." That is true of *all* the code I have wrote. -- A computer without Microsoft is like a chocolate cake without mustard.
From: Patrick Scheible on 18 Mar 2010 13:10 Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups(a)NTLWorld.COM> writes: > > > > > > Agreed. But note that the "its value" and "plus" comments aren't > > properly terminated, so the "/*" on the "its value" line introduces a > > comment that isn't terminated until the "*/" on the "one" line. The > > net result is "x = x;" > > > Hooray! At last! Well spotted. I've been waiting to see how long it > took and how many would do so. > > So not only does the mandatory comment on every line not match the > apparent code, but the apparent code isn't the actual code, as a direct > consequence of the mandatory comments. > > I'm assuming that M. Shanahan either spotted this too, or would have > done so. Lessons: Even a small change, like adding a comment, can introduce a bug (as Barb has been saying). A syntax-highlighting editor can be helpful in reducing trivial errors. Languages in which the end of the line ends a comment (such as C++, Ada, Unix shell scripts, Icon, others) reduce or contain syntax errors. -- Patrick
From: BruceS on 18 Mar 2010 14:56
On Mar 18, 11:10 am, Patrick Scheible <k...(a)zipcon.net> wrote: > Jonathan de Boyne Pollard <J.deBoynePollard-newsgro...(a)NTLWorld.COM> writes: > > > > > > > > Agreed. But note that the "its value" and "plus" comments aren't > > > properly terminated, so the "/*" on the "its value" line introduces a > > > comment that isn't terminated until the "*/" on the "one" line. The > > > net result is "x = x;" > > > Hooray! At last! Well spotted. I've been waiting to see how long it > > took and how many would do so. > > > So not only does the mandatory comment on every line not match the > > apparent code, but the apparent code isn't the actual code, as a direct > > consequence of the mandatory comments. > > > I'm assuming that M. Shanahan either spotted this too, or would have > > done so. > > Lessons: > > Even a small change, like adding a comment, can introduce a bug (as > Barb has been saying). > > A syntax-highlighting editor can be helpful in reducing trivial errors. > > Languages in which the end of the line ends a comment (such as C++, > Ada, Unix shell scripts, Icon, others) reduce or contain syntax > errors. <OT> AIUI, C++ accepts /* */ multiline comments without artificially terminating said comments at the end of line. I don't have a C++ Standard in front of me, so I can't confirm that it isn't simply an artifact of environments in which I've written C++, but I'm relatively confident that these work the same as in C. </OT> According to The C Standard, 6.4.9p2, C allows comments that *do* automatically terminate at the end of the line, just as this style of comment works in C++. One could avoid the bug in the earlier code by writing it: x // The variable x = // is assigned x // its value + // plus 2 // pi ; // . Oh, I'd better put in a :) or we'll have started another pointless whinefest. |