digitalmars.D - Patterns of Bugs
- Walter Bright (3/3) Jan 06 2011 http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html
- BlazingWhitester (3/8) Jan 06 2011 http://www.reddit.com/r/programming/comments/exfnb/patterns_of_bugs/
- Nick Sabalausky (8/11) Jan 06 2011 I noticed that C-style octal literals were conspicuously absent from the...
- Walter Bright (4/10) Jan 06 2011 I think it's obvious, too, but it ain't. Just work on a car for a while,...
- JMRyan (3/4) Jan 06 2011 Although the book is justifiably a classic, its subtitle is the very
- Nick Sabalausky (6/10) Jan 07 2011 Heh, that is an excellent point. Although more seriously, there's no dou...
- Robert Clipsham (16/19) Jan 06 2011 "It's too bad there doesn't seem to be an online repository of them.
- Guilherme Vieira (8/30) Jan 06 2011 I loved the idea, but I personally dislike Bugzilla and I wonder if it w...
- Daniel Gibson (12/35) Jan 06 2011 I don't think Bugzilla would be appropriate, because such a repository s...
- bearophile (22/35) Jan 06 2011 Thank you Walter :-)
- Jesse Phillips (3/14) Jan 06 2011 I don't see much benefit in building a "crude" prototype for such a syst...
- Max Samukha (10/13) Jan 07 2011 Good points. However, computer hardware analogies are a bit outdated.
- Nick Sabalausky (10/22) Jan 07 2011 Also, I'm pretty sure that, quite a while ago, the PS/2 ports did start
- Walter Bright (2/5) Jan 07 2011 Last time I tried that, it didn't work.
- Jesse Phillips (3/9) Jan 07 2011 You can't just try it on the same old hardware...
- Walter Bright (14/31) Jan 07 2011 I put together a new box a couple weeks ago. The memory card would fit i...
- Andrej Mitrovic (9/12) Jan 07 2011 I hate those things. There's bunch of LEDs on the PC case - USB
- Steven Schveighoffer (18/32) Jan 07 2011 That is not because the slot doesn't support the dimm, it is because man...
- Jonathan M Davis (7/10) Jan 07 2011 LOL. Yeah. Every time that I build a box, I think about how it would rea...
- Jonathan M Davis (15/26) Jan 07 2011 It's useful for informing you that the computer is starting correctly an...
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (24/50) Jan 07 2011 at if the=20
- Walter Bright (2/8) Jan 08 2011 That's a heckuva lot better than an undocumented beep pattern which is w...
- Jonathan M Davis (8/19) Jan 08 2011 LOL. The beeps for mine are documented in the motherboadr manual, but th...
- Walter Bright (4/19) Jan 08 2011 Yes, what is the difference between a "slow beep" and a "fast beep"?
- Jonathan M Davis (21/43) Jan 08 2011 nd
- Walter Bright (3/7) Jan 08 2011 I suspect as much, too, but at least "on" and "off" can be looked up in ...
- Lutger Blijdestijn (3/11) Jan 08 2011 I always assumed they meant 0 and 1. Then it's easy, just put it in an i...
- Iain Buclaw (10/21) Jan 08 2011 On the note of if statements. One pattern of bugs I see on the odd occas...
- bearophile (7/18) Jan 08 2011 See:
- Iain Buclaw (7/23) Jan 08 2011 Yep, that's the one. :)
- bearophile (8/15) Jan 08 2011 You are right, we have to create a contest site like this for IODCC (Int...
- torhu (3/12) Jan 08 2011 But that one would actually work as expected, wouldn't it? ;) The else
- Iain Buclaw (4/20) Jan 08 2011 Never let indentation fool you, the else clause will be assumed to be fo...
- Ellery Newcomer (2/4) Jan 08 2011 I don't believe you
- Iain Buclaw (8/13) Jan 08 2011 Are you saying it *isn't* interpreted as:
- Daniel Gibson (15/28) Jan 08 2011 (D1 code):
- Lars T. Kyllingstad (6/23) Jan 10 2011 From the grammar:
- Bruno Medeiros (6/26) Jan 28 2011 Hum, I never had problems with that: I always assumed the | meant a
- Daniel Gibson (2/30) Jan 28 2011 O looks like a *closed* circle to me so this isn't that helpful IMHO ;)
- Bruno Medeiros (8/38) Feb 01 2011 In my mental model (where the "|" means a closed circuit, or rather the
- Daniel Gibson (2/36) Jan 08 2011 This is kinda cool. What kind of MB is that?
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (8/19) Jan 08 2011 It is an Asus A7N8X.
- Nick Sabalausky (3/4) Jan 08 2011 Unless I'm just out-of-date, Asus does tend to be pretty good.
- Andrej Mitrovic (1/1) Jan 08 2011 I wonder if you can hack the thing to say whatever you want.
- Iain Buclaw (3/4) Jan 08 2011 If you'd could I'd program it to say “Good Afternoon Michael” every time...
- Andrej Mitrovic (4/7) Jan 07 2011 That's why I plugged it out.
- Nick Sabalausky (4/16) Jan 07 2011 IDE's been keyed for a long time too. Wasn't originally, but has been fo...
- Steven Schveighoffer (8/29) Jan 07 2011 SATA is better not because of the keyed nature of it. How many times I ...
- Nick Sabalausky (8/37) Jan 07 2011 I thought Walter was talking specifically about the keying. Also, I use
- bearophile (23/29) Jan 08 2011 The Reddit thread about this little article shows some interesting sub-t...
- Walter Bright (5/9) Jan 08 2011 Not at all. Most of software engineering work consists of plugging in
- bearophile (4/8) Jan 08 2011 I see and I agree. That "real-software-engineering" video is probably a ...
http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?
Jan 06 2011
On 2011-01-06 21:38:38 +0200, Walter Bright said:http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?http://www.reddit.com/r/programming/comments/exfnb/patterns_of_bugs/ done!
Jan 06 2011
"Walter Bright" <newshound2 digitalmars.com> wrote in message news:ig55s4$1uc3$1 digitalmars.com...http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?I noticed that C-style octal literals were conspicuously absent from the examples ;) Great article, though. Having been in D-land for so long, and being a long-time hardcore fan of the classic book "Writing Solid Code", the principles seem fairly obvious to me. But it's definitely something to pass along to other people.
Jan 06 2011
Nick Sabalausky wrote:I noticed that C-style octal literals were conspicuously absent from the examples ;)Everyone has their favorite pattern. I could literally list thousands of them.Great article, though. Having been in D-land for so long, and being a long-time hardcore fan of the classic book "Writing Solid Code", the principles seem fairly obvious to me. But it's definitely something to pass along to other people.I think it's obvious, too, but it ain't. Just work on a car for a while, and you'll see!
Jan 06 2011
"Nick Sabalausky" <a a.a> wrote in news:ig5860$231t$1 digitalmars.com:long-time hardcore fan of the classic book "Writing Solid Code", theAlthough the book is justifiably a classic, its subtitle is the very definition of the expression "unintentionally hilarious".
Jan 06 2011
"JMRyan" <nospam nospam.com> wrote in message news:ig6cjg$u8n$1 digitalmars.com..."Nick Sabalausky" <a a.a> wrote in news:ig5860$231t$1 digitalmars.com:Heh, that is an excellent point. Although more seriously, there's no doubt in my mind that at least a few programmers must have avoided the book out of the skepticism of "A book about code reliability...from *Microsoft* Press???"long-time hardcore fan of the classic book "Writing Solid Code", theAlthough the book is justifiably a classic, its subtitle is the very definition of the expression "unintentionally hilarious".
Jan 07 2011
On 06/01/11 19:38, Walter Bright wrote:http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?"It's too bad there doesn't seem to be an online repository of them. They would make for great research material for programming language designers. Every one you can design out of existence will incrementally improve the productivity of programmers." Perhaps someone here would like to volunteer for this? I guess some kind of moderated bugzilla would do the trick, it'd be awesome to have some table of languages and how many of the types bugs they prevent/kind of prevent as well. If no one else volunteers I guess I could hack something crude together, it would still need people to volunteer bugs for it, as well as sources/proof for each bug (links to changesets/projects that have encountered this issue etc). -- Robert http://octarineparrot.com/
Jan 06 2011
On Thu, Jan 6, 2011 at 6:25 PM, Robert Clipsham <robert octarineparrot.com>wrote:On 06/01/11 19:38, Walter Bright wrote:I loved the idea, but I personally dislike Bugzilla and I wonder if it would work for something like that. Anyway a voting system would be mandatory. In any case, isn't there something like this already? -- Atenciosamente / Sincerely, Guilherme ("n2liquid") Vieirahttp://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?"It's too bad there doesn't seem to be an online repository of them. They would make for great research material for programming language designers. Every one you can design out of existence will incrementally improve the productivity of programmers." Perhaps someone here would like to volunteer for this? I guess some kind of moderated bugzilla would do the trick, it'd be awesome to have some table of languages and how many of the types bugs they prevent/kind of prevent as well. If no one else volunteers I guess I could hack something crude together, it would still need people to volunteer bugs for it, as well as sources/proof for each bug (links to changesets/projects that have encountered this issue etc). -- Robert http://octarineparrot.com/
Jan 06 2011
Am 06.01.2011 21:37, schrieb Guilherme Vieira:On Thu, Jan 6, 2011 at 6:25 PM, Robert Clipsham <robert octarineparrot.com <mailto:robert octarineparrot.com>> wrote: On 06/01/11 19:38, Walter Bright wrote: http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit? "It's too bad there doesn't seem to be an online repository of them. They would make for great research material for programming language designers. Every one you can design out of existence will incrementally improve the productivity of programmers." Perhaps someone here would like to volunteer for this? I guess some kind of moderated bugzilla would do the trick, it'd be awesome to have some table of languages and how many of the types bugs they prevent/kind of prevent as well. If no one else volunteers I guess I could hack something crude together, it would still need people to volunteer bugs for it, as well as sources/proof for each bug (links to changesets/projects that have encountered this issue etc). -- Robert http://octarineparrot.com/ I loved the idea, but I personally dislike Bugzilla and I wonder if it would work for something like that. Anyway a voting system would be mandatory. In any case, isn't there something like this already?I don't think Bugzilla would be appropriate, because such a repository should collect bugs from many different projects. Something that allows to sort the bugs into categories etc is needed IMHO. So you'd have rough categories of bugs, sub-(sub-sub-)categories of that and at some point links to the actual bugs in the respective bugtrackers of the monitored projects. Of course support for that in various bugtrackers would be great, so the bugfixer could just select the appropriate (sub)category of the bug and it would automatically be submitted to the repository. Cheers, - Daniel
Jan 06 2011
Walter:http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!)Thank you Walter :-) The article is simple but nice. Few comments:The possible mechanic's mistake is designed out of the system.In the first books written by Donald Norman there are many examples of wrong design, "foolproof" design, etc: http://en.wikipedia.org/wiki/Donald_Norman(!E && !E->fld) is a nonsense expression, and what was probably meant was: (!E || !E->fld) What's the process fix for this bug pattern?Even the correct version is not nice code :-)In the D programming language, we didn't wish to mess with the operator precedences in order to avoid behavior that would be surprising to experienced programmers.<Experienced _C_ programmers (as you written below) :-)A common pattern is the classic fencepost bug: int A[10]; for (int i = 0; i <= 10; i++) ... = A[i];This little C99 program: #include <stdio.h> int main() { int A[10] = {0,1,2,3,4,5,6,7,8,9}; int total = 0; for (int i = 0; i <= 10; i++) total += A[i]; // line 6 printf("%d\n", total); return 0; } The good Gimpel lint catches the bug statically: diy.c 6 Warning 661: Possible access of out-of-bounds pointer (1 beyond end of data) by operator '[' [Reference: file diy.c: lines 5, 6] It's able to catch more complex situations too (but not all situations). Bye, bearophile
Jan 06 2011
Guilherme Vieira Wrote:On Thu, Jan 6, 2011 at 6:25 PM, Robert Clipsham <robert octarineparrot.com>wrote:I don't see much benefit in building a "crude" prototype for such a system. If it is going to be done the person should really run with the idea; research what tools are out their for managing a system and doing what it takes to make a usable, friendly, and meaningful implementation. Modifications to analysis tools could be made which would crawl public repositories looking for known patterns (not to claim it is a bug), similar to Ohloh and its crawling tools.If no one else volunteers I guess I could hack something crude together, it would still need people to volunteer bugs for it, as well as sources/proof for each bug (links to changesets/projects that have encountered this issue etc). I loved the idea, but I personally dislike Bugzilla and I wonder if it wouldwork for something like that. Anyway a voting system would be mandatory. In any case, isn't there something like this already?
Jan 06 2011
On 01/06/2011 09:38 PM, Walter Bright wrote:http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?Good points. However, computer hardware analogies are a bit outdated. For example, USB is prevalent nowadays. You connect a USB keyboard, mouse or whatever to a slot, which is closest to you and forget about it. Also, memory module connectors are incompatible starting from I believe DDR. You won't be able to stick DDR2 module into DDR slot. Actually, this applies to almost any modern PC component. I'm afraid the principles you are describing are not something new in the software industry. I can't remember the first time I heard the term "fool-proof software".
Jan 07 2011
"Max Samukha" <spambox d-coding.com> wrote in message news:ig7jqi$1mfe$1 digitalmars.com...On 01/06/2011 09:38 PM, Walter Bright wrote:Also, I'm pretty sure that, quite a while ago, the PS/2 ports did start getting made to work with either keyboard or mouse even though they often still got labeled as being just one or the other. And I can't think of a component in my system that isn't keyed but should be. Even IDE ports/plugs started getting keyed a long time ago. But yea, audio-in versus audio-out is still one notable case where you can put the wrong thing in the wrong place. Although, most speakers/headphones do actually work as low-quality microphones :)http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?Good points. However, computer hardware analogies are a bit outdated. For example, USB is prevalent nowadays. You connect a USB keyboard, mouse or whatever to a slot, which is closest to you and forget about it. Also, memory module connectors are incompatible starting from I believe DDR. You won't be able to stick DDR2 module into DDR slot. Actually, this applies to almost any modern PC component.
Jan 07 2011
Nick Sabalausky wrote:Also, I'm pretty sure that, quite a while ago, the PS/2 ports did start getting made to work with either keyboard or mouse even though they often still got labeled as being just one or the other.Last time I tried that, it didn't work.
Jan 07 2011
Walter Bright Wrote:Nick Sabalausky wrote:You can't just try it on the same old hardware... It works for me, though I don't have a PS/2 mouse anymore to try it this instant. I know many laptops have come with a single PS/2 slot which accepts either.Also, I'm pretty sure that, quite a while ago, the PS/2 ports did start getting made to work with either keyboard or mouse even though they often still got labeled as being just one or the other.Last time I tried that, it didn't work.
Jan 07 2011
Max Samukha wrote:On 01/06/2011 09:38 PM, Walter Bright wrote:Yes, USB is a big improvement. So is SATA.http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?Good points. However, computer hardware analogies are a bit outdated. For example, USB is prevalent nowadays. You connect a USB keyboard, mouse or whatever to a slot, which is closest to you and forget about it.Also, memory module connectors are incompatible starting from I believe DDR. You won't be able to stick DDR2 module into DDR slot. Actually, this applies to almost any modern PC component.I put together a new box a couple weeks ago. The memory card would fit in one of 4 slots. The first one I tried it in resulted in a computer that just beeped at me. No help from the manual at all, I was ready to RMA the mobo back, until I had the idea of putting the card in a different slot. The second one I tried worked. You're right that many things in the computer hardware are better. But still, many connections to the mobo can be done wrong. For example, all the pins coming from the front panel. Some of them, like the hard drive LED, don't even indicate the polarity on the connector, and you have to try it both ways until you figure out which one works.I'm afraid the principles you are describing are not something new in the software industry. I can't remember the first time I heard the term "fool-proof software".I'm not saying they are new - heck, trying to eliminate buggy code patterns goes back to trying to get rid of goto. And, of course, many static analysis tools attempt to identify obviously buggy but legal C patterns.
Jan 07 2011
On 1/7/11, Walter Bright <newshound2 digitalmars.com> wrote:Some of them, like the hard drive LED, don't even indicate the polarity on the connector..I hate those things. There's bunch of LEDs on the PC case - USB indicators, power LEDs, etc, and they all have this super-tiny connector and they have to be put together in a really tight place on the motherboard. I leave the PC speaker disconnected though, who needs that thing anyway? :p AFAIK most of the new motherboards use a different color for the PS/2 keyboard vs mouse connectors, so it's not as if the PC industry is ignoring those problems.
Jan 07 2011
On Fri, 07 Jan 2011 13:47:43 -0500, Walter Bright <newshound2 digitalmars.com> wrote:Max Samukha wrote:That is not because the slot doesn't support the dimm, it is because many chipsets require you populate memory in a specific order. Usually the slots are color coded (blue and black for instance) to indicate which slots should go together (some chipsets require pairs of dimms), they are usually labeled with silkscreen to indicate the order. I think I've even seen silkscreened instructions on which to populate first. It sucks that the manual doesn't help you. BTW, the beep is usually an indicator of a POST code. It's because it cannot access the memory, so it can't run the graphics card, the beep is the only way it can communicate ;) I think (but I'm not sure) that the beeps convey the code, but the easiest way to figure out the code is to plug in a POST card.Also, memory module connectors are incompatible starting from I believe DDR. You won't be able to stick DDR2 module into DDR slot. Actually, this applies to almost any modern PC component.I put together a new box a couple weeks ago. The memory card would fit in one of 4 slots. The first one I tried it in resulted in a computer that just beeped at me. No help from the manual at all, I was ready to RMA the mobo back, until I had the idea of putting the card in a different slot. The second one I tried worked.You're right that many things in the computer hardware are better. But still, many connections to the mobo can be done wrong. For example, all the pins coming from the front panel. Some of them, like the hard drive LED, don't even indicate the polarity on the connector, and you have to try it both ways until you figure out which one works.Typically, those are not keyed because it's not expected for a normal user to be accessing those cables. Removing the cover of a PC is like casting in D :) -Steve
Jan 07 2011
On Friday, January 07, 2011 11:07:54 Steven Schveighoffer wrote:Typically, those are not keyed because it's not expected for a normal user to be accessing those cables. Removing the cover of a PC is like casting in D :)LOL. Yeah. Every time that I build a box, I think about how it would really be nice if they standardized them better and made it much easier to just plug stuff in without all of the cables floating around in the box. But that would make them cost more money, and since you don't actually have to mess with them that often, it just isn't worth it. It sure would be nice though. - Jonathan M Davis
Jan 07 2011
On Friday, January 07, 2011 11:06:23 Andrej Mitrovic wrote:On 1/7/11, Walter Bright <newshound2 digitalmars.com> wrote:It's useful for informing you that the computer is starting correctly and gives you an idea of what's wrong if it isn't (though you can live without that if the computer seems to be okay). It's also useful for things like for when your CPU is getting too warm. However, I think that it's horrific that anything in the OS or any program on the computer at all uses the PC speaker. It is _annoying_ when the command-line of all things starts beeping at you because you hit backspace too many times or something like that. At the moment, I haven't been configuring my kernel recently (which is _not_ a fun thing to have to keep doing on every kernel update IMHO), but when I was, I specifically did _not_ compile in the PC speaker driver. I wish that that were the norm. Which reminds me, while the PC speaker is disabled in KDE, I really need to go and track down which change I need to make where to silence it when I've booted to the console rather than all the way into KDE... - Jonathan M DavisSome of them, like the hard drive LED, don't even indicate the polarity on the connector..I hate those things. There's bunch of LEDs on the PC case - USB indicators, power LEDs, etc, and they all have this super-tiny connector and they have to be put together in a really tight place on the motherboard. I leave the PC speaker disconnected though, who needs that thing anyway? :p
Jan 07 2011
Jonathan M Davis wrote:On Friday, January 07, 2011 11:06:23 Andrej Mitrovic wrote:On 1/7/11, Walter Bright <newshound2 digitalmars.com> wrote:Some of them, like the hard drive LED, don't even indicate the polarity on the connector..I hate those things. There's bunch of LEDs on the PC case - USB indicators, power LEDs, etc, and they all have this super-tiny connector and they have to be put together in a really tight place on the motherboard. I leave the PC speaker disconnected though, who needs=nd gives=20that thing anyway? :p=20 It's useful for informing you that the computer is starting correctly a=you an idea of what's wrong if it isn't (though you can live without th=at if the=20computer seems to be okay). It's also useful for things like for when y=our CPU=20is getting too warm. However, I think that it's horrific that anything =in the OS=20or any program on the computer at all uses the PC speaker. It is _annoy=ing_ when=20the command-line of all things starts beeping at you because you hit ba=ckspace=20too many times or something like that. At the moment, I haven't been co=nfiguring=20my kernel recently (which is _not_ a fun thing to have to keep doing on=every=20kernel update IMHO), but when I was, I specifically did _not_ compile i=n the PC=20speaker driver. I wish that that were the norm. Which reminds me, while=the PC=20speaker is disabled in KDE, I really need to go and track down which ch=ange I=20need to make where to silence it when I've booted to the console rather=than all=20the way into KDE... =20When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;) Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jan 07 2011
Jérôme M. Berger wrote:When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)That's a heckuva lot better than an undocumented beep pattern which is what I got.
Jan 08 2011
On Saturday 08 January 2011 00:16:13 Walter Bright wrote:J=C3=A9r=C3=B4me M. Berger wrote:atWhen I built my latest PC, I saw in the MB manual that it would use =20 speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)=20 That's a heckuva lot better than an undocumented beep pattern which is wh=I got.LOL. The beeps for mine are documented in the motherboadr manual, but the b= eeps=20 are so hard to distinguish from one another, that it borders on useless. A = voice=20 would certainly be better. =2D Jonathan M Davis
Jan 08 2011
Jonathan M Davis wrote:On Saturday 08 January 2011 00:16:13 Walter Bright wrote:Yes, what is the difference between a "slow beep" and a "fast beep"? While I'm ranting, does anyone else have trouble remembering which of O and | is on, and which is off? What's the matter with "on" and "off"?Jérôme M. Berger wrote:LOL. The beeps for mine are documented in the motherboadr manual, but the beeps are so hard to distinguish from one another, that it borders on useless. A voice would certainly be better.When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)That's a heckuva lot better than an undocumented beep pattern which is what I got.
Jan 08 2011
On Saturday 08 January 2011 01:14:41 Walter Bright wrote:Jonathan M Davis wrote:heOn Saturday 08 January 2011 00:16:13 Walter Bright wrote:J=C3=A9r=C3=B4me M. Berger wrote:=20 LOL. The beeps for mine are documented in the motherboadr manual, but t=When I built my latest PC, I saw in the MB manual that it would use =20 speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)=20 That's a heckuva lot better than an undocumented beep pattern which is what I got.ndbeeps are so hard to distinguish from one another, that it borders on useless. A voice would certainly be better.=20 Yes, what is the difference between a "slow beep" and a "fast beep"? =20 While I'm ranting, does anyone else have trouble remembering which of O a=| is on, and which is off? What's the matter with "on" and "off"?I didn't even find out that the sign on many power switches was a 1 inside = a 0=20 until recently, so the symbols meant nothing to me. I would _assume_ that 1= =20 means on and 0 means off since a bit that's 1 is on/true and a bit that's 0= is=20 off/false (and looking at the power switch on my computer right now, that d= oes=20 indeed appear to be the case), but I normally have to just guess whether=20 something is on or off if you can't tell from something other than the powe= r=20 switch. On and Off would be much better, but I suspect that it's one of tho= se=20 things where they chose symbols instead so that they didn't have to worry a= bout=20 internationalization. That way, it confuses _everyone_ instead of just non- English speakers. ;) =2D Jonathan M Davis
Jan 08 2011
Jonathan M Davis wrote:On and Off would be much better, but I suspect that it's one of those things where they chose symbols instead so that they didn't have to worry about internationalization. That way, it confuses _everyone_ instead of just non- English speakers. ;)I suspect as much, too, but at least "on" and "off" can be looked up in a dictionary. There's no hope for O and |.
Jan 08 2011
Walter Bright wrote:Jonathan M Davis wrote:I always assumed they meant 0 and 1. Then it's easy, just put it in an if() statement :)On and Off would be much better, but I suspect that it's one of those things where they chose symbols instead so that they didn't have to worry about internationalization. That way, it confuses _everyone_ instead of just non- English speakers. ;)I suspect as much, too, but at least "on" and "off" can be looked up in a dictionary. There's no hope for O and |.
Jan 08 2011
== Quote from Lutger Blijdestijn (lutger.blijdestijn gmail.com)'s articleWalter Bright wrote:On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and realise it wouldn't work as expected without the missing braces added. ;)Jonathan M Davis wrote:I always assumed they meant 0 and 1. Then it's easy, just put it in an if() statement :)On and Off would be much better, but I suspect that it's one of those things where they chose symbols instead so that they didn't have to worry about internationalization. That way, it confuses _everyone_ instead of just non- English speakers. ;)I suspect as much, too, but at least "on" and "off" can be looked up in a dictionary. There's no hope for O and |.
Jan 08 2011
Iain Buclaw:On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and realise it wouldn't work as expected without the missing braces added. ;)See: http://d.puremagic.com/issues/show_bug.cgi?id=4375 http://d.puremagic.com/issues/show_bug.cgi?id=4924 http://d.puremagic.com/issues/show_bug.cgi?id=4283 Bye, bearophile
Jan 08 2011
== Quote from bearophile (bearophileHUGS lycos.com)'s articleIain Buclaw:areOn the note of if statements. One pattern of bugs I see on the odd occasionYep, that's the one. :)else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and realise it wouldn't work as expected without the missing braces added. ;)See: http://d.puremagic.com/issues/show_bug.cgi?id=4375http://d.puremagic.com/issues/show_bug.cgi?id=4924I don't see that as a bug, and that enforces a certain coding style onto the end programmer (does no one give thought/praise to obfuscation anymore? ;)http://d.puremagic.com/issues/show_bug.cgi?id=4283That's certainly a nice looking bug there. But not related in the slightest. Regards
Jan 08 2011
Iain Buclaw:I agree that's a bit controversial, but a known C lint finds that problem, and every strategy is good against bugs :-)http://d.puremagic.com/issues/show_bug.cgi?id=4924I don't see that as a bug, and that enforces a certain coding style onto the end programmer(does no one give thought/praise to obfuscation anymore? ;)You are right, we have to create a contest site like this for IODCC (International Obfuscated D Code Contest): http://www.ioccc.org/ This contest has also caused the creation of that fine piece of software that is the TCC (Tiny C compiler).It's related in a sense, it shows an example of a dangling else bug done by the language too :-) Bye, bearophilehttp://d.puremagic.com/issues/show_bug.cgi?id=4283That's certainly a nice looking bug there. But not related in the slightest.
Jan 08 2011
On 08.01.2011 15:13, Iain Buclaw wrote:On the note of if statements. One pattern of bugs I see on the odd occasion are else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and realise it wouldn't work as expected without the missing braces added. ;)But that one would actually work as expected, wouldn't it? ;) The else belongs to the second if, which matches your indentation.
Jan 08 2011
== Quote from torhu (no spam.invalid)'s articleOn 08.01.2011 15:13, Iain Buclaw wrote:areOn the note of if statements. One pattern of bugs I see on the odd occasionNever let indentation fool you, the else clause will be assumed to be for the first condition. :o)else statements written like this: if (condition1) if (condition2) statement1; else statement2; Always takes a moment or two to look again and realise it wouldn't work as expected without the missing braces added. ;)But that one would actually work as expected, wouldn't it? ;) The else belongs to the second if, which matches your indentation.
Jan 08 2011
On 01/08/2011 02:37 PM, Iain Buclaw wrote:Never let indentation fool you, the else clause will be assumed to be for the first condition. :o)I don't believe you
Jan 08 2011
== Quote from Ellery Newcomer (ellery-newcomer utulsa.edu)'s articleOn 01/08/2011 02:37 PM, Iain Buclaw wrote:Are you saying it *isn't* interpreted as: if (i) if (j) printf("J true\n"); else printf("I false\n"); :oNever let indentation fool you, the else clause will be assumed to be for the first condition. :o)I don't believe you
Jan 08 2011
Am 08.01.2011 21:53, schrieb Iain Buclaw:== Quote from Ellery Newcomer (ellery-newcomer utulsa.edu)'s article(D1 code): import std.stdio; void main(string[] args) { if(args.length > 1) if(args.length > 2) writefln("foo"); else writefln("bar"); } caedes Mancubus:/tmp $ ./test caedes Mancubus:/tmp $ ./test a bar caedes Mancubus:/tmp $ ./test a b fooOn 01/08/2011 02:37 PM, Iain Buclaw wrote:Are you saying it *isn't* interpreted as: if (i) if (j) printf("J true\n"); else printf("I false\n"); :oNever let indentation fool you, the else clause will be assumed to be for the first condition. :o)I don't believe you
Jan 08 2011
On Sat, 08 Jan 2011 20:53:20 +0000, Iain Buclaw wrote:== Quote from Ellery Newcomer (ellery-newcomer utulsa.edu)'s articleFrom the grammar: "The 'dangling else' parsing problem is solved by associating the else with the nearest if statement." http://www.digitalmars.com/d/2.0/statement.html#IfStatement -LarsOn 01/08/2011 02:37 PM, Iain Buclaw wrote:Are you saying it *isn't* interpreted as: if (i) if (j) printf("J true\n"); else printf("I false\n"); :oNever let indentation fool you, the else clause will be assumed to be for the first condition. :o)I don't believe you
Jan 10 2011
On 08/01/2011 09:14, Walter Bright wrote:Jonathan M Davis wrote:Hum, I never had problems with that: I always assumed the | meant a closed electrical circuit (ie, you closed the circuit with the switch), thus naturally it meant "on". -- Bruno Medeiros - Software EngineerOn Saturday 08 January 2011 00:16:13 Walter Bright wrote:Yes, what is the difference between a "slow beep" and a "fast beep"? While I'm ranting, does anyone else have trouble remembering which of O and | is on, and which is off? What's the matter with "on" and "off"?Jérôme M. Berger wrote:LOL. The beeps for mine are documented in the motherboadr manual, but the beeps are so hard to distinguish from one another, that it borders on useless. A voice would certainly be better.When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)That's a heckuva lot better than an undocumented beep pattern which is what I got.
Jan 28 2011
Am 28.01.2011 13:33, schrieb Bruno Medeiros:On 08/01/2011 09:14, Walter Bright wrote:O looks like a *closed* circle to me so this isn't that helpful IMHO ;)Jonathan M Davis wrote:Hum, I never had problems with that: I always assumed the | meant a closed electrical circuit (ie, you closed the circuit with the switch), thus naturally it meant "on".On Saturday 08 January 2011 00:16:13 Walter Bright wrote:Yes, what is the difference between a "slow beep" and a "fast beep"? While I'm ranting, does anyone else have trouble remembering which of O and | is on, and which is off? What's the matter with "on" and "off"?Jérôme M. Berger wrote:LOL. The beeps for mine are documented in the motherboadr manual, but the beeps are so hard to distinguish from one another, that it borders on useless. A voice would certainly be better.When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)That's a heckuva lot better than an undocumented beep pattern which is what I got.
Jan 28 2011
On 28/01/2011 12:41, Daniel Gibson wrote:Am 28.01.2011 13:33, schrieb Bruno Medeiros:In my mental model (where the "|" means a closed circuit, or rather the part of the circuit that closes it and makes electricity pass through), the "O" doesn't fit well into that model, indeed, it makes no sense. But just for the purposes of remembering which one is on or off, that doesn't matter at all: I just think of "is the | pressed or not?". -- Bruno Medeiros - Software EngineerOn 08/01/2011 09:14, Walter Bright wrote:O looks like a *closed* circle to me so this isn't that helpful IMHO ;)Jonathan M Davis wrote:Hum, I never had problems with that: I always assumed the | meant a closed electrical circuit (ie, you closed the circuit with the switch), thus naturally it meant "on".On Saturday 08 January 2011 00:16:13 Walter Bright wrote:Yes, what is the difference between a "slow beep" and a "fast beep"? While I'm ranting, does anyone else have trouble remembering which of O and | is on, and which is off? What's the matter with "on" and "off"?Jérôme M. Berger wrote:LOL. The beeps for mine are documented in the motherboadr manual, but the beeps are so hard to distinguish from one another, that it borders on useless. A voice would certainly be better.When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;)That's a heckuva lot better than an undocumented beep pattern which is what I got.
Feb 01 2011
Am 08.01.2011 08:57, schrieb "Jérôme M. Berger":Jonathan M Davis wrote:This is kinda cool. What kind of MB is that?On Friday, January 07, 2011 11:06:23 Andrej Mitrovic wrote:When I built my latest PC, I saw in the MB manual that it would use speech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;) JeromeOn 1/7/11, Walter Bright<newshound2 digitalmars.com> wrote:It's useful for informing you that the computer is starting correctly and gives you an idea of what's wrong if it isn't (though you can live without that if the computer seems to be okay). It's also useful for things like for when your CPU is getting too warm. However, I think that it's horrific that anything in the OS or any program on the computer at all uses the PC speaker. It is _annoying_ when the command-line of all things starts beeping at you because you hit backspace too many times or something like that. At the moment, I haven't been configuring my kernel recently (which is _not_ a fun thing to have to keep doing on every kernel update IMHO), but when I was, I specifically did _not_ compile in the PC speaker driver. I wish that that were the norm. Which reminds me, while the PC speaker is disabled in KDE, I really need to go and track down which change I need to make where to silence it when I've booted to the console rather than all the way into KDE...Some of them, like the hard drive LED, don't even indicate the polarity on the connector..I hate those things. There's bunch of LEDs on the PC case - USB indicators, power LEDs, etc, and they all have this super-tiny connector and they have to be put together in a really tight place on the motherboard. I leave the PC speaker disconnected though, who needs that thing anyway? :p
Jan 08 2011
Daniel Gibson wrote:Am 08.01.2011 08:57, schrieb "J=C3=A9r=C3=B4me M. Berger":eWhen I built my latest PC, I saw in the MB manual that it would us=It is an Asus A7N8X. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.frspeech synthesis on the PC speaker to report errors. So I tried to power on the PC without having plugged either CPU or RAM and it started to say "NO CPU FOUND! NO CPU FOUND!" in a loop with a hilarious Asian accent and the kind of rasping voice that used to characterized old DOS games. Pretty fun ;) Jerome=20 This is kinda cool. What kind of MB is that?
Jan 08 2011
""Jérôme M. Berger"" <jeberger free.fr> wrote in message news:igaasf$rdh$1 digitalmars.com...It is an Asus A7N8X.Unless I'm just out-of-date, Asus does tend to be pretty good.
Jan 08 2011
I wonder if you can hack the thing to say whatever you want.
Jan 08 2011
== Quote from Andrej Mitrovic (andrej.mitrovich gmail.com)'s articleI wonder if you can hack the thing to say whatever you want.If you'd could I'd program it to say “Good Afternoon Michael” every time I turn it on.
Jan 08 2011
On 1/7/11, Jonathan M Davis <jmdavisProg gmx.com> wrote:However, I think that it's horrific that anything in the OS or any program on the computer at all uses the PC speaker.That's why I plugged it out. Although... the PC speaker was awesome in DOS games! Loved the sounds and music coming out of it.
Jan 07 2011
"Walter Bright" <newshound2 digitalmars.com> wrote in message news:ig7n8o$1t3u$1 digitalmars.com...Max Samukha wrote:IDE's been keyed for a long time too. Wasn't originally, but has been for a long time now.On 01/06/2011 09:38 PM, Walter Bright wrote:Yes, USB is a big improvement. So is SATA.http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?Good points. However, computer hardware analogies are a bit outdated. For example, USB is prevalent nowadays. You connect a USB keyboard, mouse or whatever to a slot, which is closest to you and forget about it.
Jan 07 2011
On Fri, 07 Jan 2011 14:44:10 -0500, Nick Sabalausky <a a.a> wrote:"Walter Bright" <newshound2 digitalmars.com> wrote in message news:ig7n8o$1t3u$1 digitalmars.com...SATA is better not because of the keyed nature of it. How many times I have tried to twist around my IDE cables so they would be the right way to plug into two components! That small cable makes a world of difference. Same thing with HDMI -- instead of 3-5 clunky cables that hopefully are color coded correctly, you get one cable transmitting all data. -SteveMax Samukha wrote:IDE's been keyed for a long time too. Wasn't originally, but has been for a long time now.On 01/06/2011 09:38 PM, Walter Bright wrote:Yes, USB is a big improvement. So is SATA.http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?Good points. However, computer hardware analogies are a bit outdated. For example, USB is prevalent nowadays. You connect a USB keyboard, mouse or whatever to a slot, which is closest to you and forget about it.
Jan 07 2011
"Steven Schveighoffer" <schveiguy yahoo.com> wrote in message news:op.voyerqyseav7ka steve-laptop...On Fri, 07 Jan 2011 14:44:10 -0500, Nick Sabalausky <a a.a> wrote:I thought Walter was talking specifically about the keying. Also, I use these on my IDE drives which have been around for quite a few years: http://www.microcenter.com/single_product_results.phtml?product_id=0285984 (They do something special with the shielding inside so that the wires don't have to be in a big ribbon). Granted, SATA cables are even better still, but these are still a huge improvement over the older-style IDE cables."Walter Bright" <newshound2 digitalmars.com> wrote in message news:ig7n8o$1t3u$1 digitalmars.com...SATA is better not because of the keyed nature of it. How many times I have tried to twist around my IDE cables so they would be the right way to plug into two components! That small cable makes a world of difference. Same thing with HDMI -- instead of 3-5 clunky cables that hopefully are color coded correctly, you get one cable transmitting all data.Max Samukha wrote:IDE's been keyed for a long time too. Wasn't originally, but has been for a long time now.On 01/06/2011 09:38 PM, Walter Bright wrote:Yes, USB is a big improvement. So is SATA.http://www.drdobbs.com/blog/archives/2011/01/patterns_of_bug.html (dedicated to bearophile!) Anyone want to post it on reddit?Good points. However, computer hardware analogies are a bit outdated. For example, USB is prevalent nowadays. You connect a USB keyboard, mouse or whatever to a slot, which is closest to you and forget about it.
Jan 07 2011
The Reddit thread about this little article shows some interesting sub-threads: http://www.reddit.com/r/programming/comments/exfnb/patterns_of_bugs/ So I add some more comments to my first answer to the article: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=126262 I too miss (a < b < c) in D, it's short, its meaning comes from mathematics and it gives no confusion, it's more DRY than the D way and it evaluates the 'b' variable only once. So it's a complete win across the whole line. But given the original design decision of D, I agree that the D choice of disallowing it is correct.The design to prevent mistakes from entering the system is called Mistake Proofing and was turned into a rigorous engineering practice by Shigeo Shingo.<See: http://en.wikipedia.org/wiki/Poka-yokeIt is ironic that the company that created the technique that is a guiding inspiration for Agile software, didn't use their own physical manufacturing techniques when it came to writing their software.<Right :-] Maybe they think they are just a hardware firm, or they don't understand that software is way more complex than hardware, etc. I don't know the causes.The problem here is that writing code is a creative thinking process. Bolting things to an airplane is not.<This is an important insight that I think Walter article misses. This nice video talk about software engineering practice explains what that means: http://confreaks.net/videos/282-lsrc2010-real-software-engineering Among other things, the talk explains an important difference between software engineering and other engineering fields where an engineer draws a project and then some people build it. In software engineering the program is the project, the "people" that "build it" are the computer languages, and the final result is the software running for the user. If in software engineering the program is the project, then writing a program is the equivalent of creating the project. According to the talk programming is like the design stage of an aeroplane, so comparing programming to bolting things to an aeroplane is the wrong analogy for writing software. If this is true, then a language has to be designed to help the design stage, that probably is better done Agile.Over in the D newsgroups, there are often impassioned debates about whether particular patterns should be justifiably banned as being more trouble than they are worth. More than a few suggest I set the bar unreasonably high - in that D allows things that many suggest are fatally error prone (an example is the default fall-through on switch case statements).<This was written by Walter and I don't understand what he is trying to say. But I'd like to improve the D switch, as we have discussed: http://d.puremagic.com/issues/show_bug.cgi?id=4349In general, this strategy works, but there's this odd thing that happens in the other direction also. Sometimes a bit less checking can lead to more diligence. We see this with dynamic typing. People often consider it inherently unsafe, but programmers adjust and often end up without worse runtime error rates. It's sort of like this: http://www.wired.com/wired/archive/12.12/traffic.htmlWe can design away the possibility of some errors, but we can also design in situations which demand diligence. People react in many subtle ways. That gives us a very large design space.< This is another exceptionally good comment. This may partially explain why my Python programs are not more buggy than my D code (quite the opposite in truth) despite I am using D for years, and D has consts, a static type system and I write equally unit-tests in D and Python, and in D I also use Design By Contracts, etc (it explains the situation just partially. Surely Python multi-precision numbers on default avoid several troubles normally present in D code). Here we are probably talking about Risk homeostasis or Risk compensation in programming and language design: http://en.wikipedia.org/wiki/Risk_homeostasis http://en.wikipedia.org/wiki/Risk_compensationThe hypothesis of risk homeostasis holds that everyone has his or her own fixed level of acceptable risk. When the level of risk in one part of the individual's life changes, there will be a corresponding rise or fall in risk elsewhere to bring the overall risk back to that individual's equilibrium. Wilde argues that the same is true of larger human systems, e.g. a population of drivers.<The idea here is that D offers more built-in safeties, but programmers often just program more sloppily, producing at the end about as many bugs. Surely Python programs are more precise in their code formatting (because indentations are part of the syntax), the result is that Python code is often formatted better than D code and it's more uniform across different programmers. This kills some useless discussions (where to put braces?) and allows people to put inside their own Python projects code written by other Python programmers avoiding to produce a program that looks like an Harlequin of different styles. Bye, bearophile
Jan 08 2011
bearophile wrote:Not at all. Most of software engineering work consists of plugging in subassemblies. In this case, designing the grammar such that the "subassemblies" of the grammar won't fit together in ways that don't make sense is perfectly analogous.The problem here is that writing code is a creative thinking process. Bolting things to an airplane is not.<This is an important insight that I think Walter article misses.
Jan 08 2011
Walter:Not at all. Most of software engineering work consists of plugging in subassemblies. In this case, designing the grammar such that the "subassemblies" of the grammar won't fit together in ways that don't make sense is perfectly analogous.I see and I agree. That "real-software-engineering" video is probably a bit extreme, the truth is probably more mixed, this means that software engineering is not 100% design work, there's some bolting too :-) Bye, bearophile
Jan 08 2011