Funny

This is a discussion on Funny within the A Brief History of Cprogramming.com forums, part of the Community Boards category; From my Intro to C programming class (which is funny in general, imagine a lecture hall full of 150 people, ...

  1. #1
    Evil Member
    Join Date
    Jan 2002
    Posts
    638

    Funny

    From my Intro to C programming class (which is funny in general, imagine a lecture hall full of 150 people, 100 of whom are already competent C programmers who are stuck there because it is unavoidable...)

    The teacher put the course notes on her website, and included in the style guide is this little gem...


    11.
    Do not use the goto statement.

    The goto statement is evil! If you need to use it, it is a definite sign of bad code. Those who use the goto statement will be punished.
    Not just bad, but evil... Not just penalized, but punished...

    Not that I disagree with the statement, but I found the wording interesting.

    Of course its about as funny as the third slide of the powerpoint presentation she gave the class, which was a picture of a computer with lines pointing to the monitor, keyboard, joystick, speakers, and so on.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Man thats pretty good stuff. How was the class unavoidable? At most colleges you can challenge any class. The teacher will give you the final and if you pass it you get a P for the class I believe. No gpa points are awarded but you receive the full 3 credits or however many the class is. I did this for a 'intro to computers' class.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Prelude's Translations:

    >The goto statement is evil!
    Translation:
    I'm an idiot.

    >If you need to use it, it is a definite sign of bad code.
    Translation:
    I've only written trivial programs and never needed goto, so anyone who uses it is a bad programmer.

    >Those who use the goto statement will be punished.
    I'm trying to make everyone believe my flawed logic through intimidation.

    This is a good one, would it be possible for you to post a link to this website? I like a good laugh every now and again.

    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by Prelude
    Prelude's Translations:

    >The goto statement is evil!
    Translation:
    I'm an idiot.

    >If you need to use it, it is a definite sign of bad code.
    Translation:
    I've only written trivial programs and never needed goto, so anyone who uses it is a bad programmer.

    >Those who use the goto statement will be punished.
    I'm trying to make everyone believe my flawed logic through intimidation.

    This is a good one, would it be possible for you to post a link to this website? I like a good laugh every now and again.

    -Prelude
    I was thinking the same thing. I cannot fathom the other things that she has put on there. I can't wait to see!
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    aurë entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    Even Knuth (somwhere I know) talks about the advantages of goto...correct me if I'm wrong prelude

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    i know this is the 267'th time this has been asked...
    but what advantages are there to using goto? can't everything be done with an equivalent non-goto command that looks and fits better?

  7. #7
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Say you are in a series of 4 or 5 nested loops and you want to break out of all of them. Which is more effecient, having a flag and breaking out of each loop individually or using a goto to right after the loop?

  8. #8
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    I agree with both parties here.

    Yes, Prelude and the other board members have a point about goto and the JMP opcode having usefulness in really time-critical applications, where exiting a control stucture gracefully is not an option, but I see where it would be a good idea for Dr. Nihan to impress on introductory students that goto is not the magic wand it first appears to be.

    Also, for anyone interested, Clicky!

    The "Programming Style Guide" is where that quote was pulled.

    The notes from the first lecture are also visible, you can hear my response to that here.

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    I agree (more or less) with everything on that page except for the comment about goto. I feel it shoudn't be used except when absolutely necessary, but a thoughtless ban on its use is stupid.

    -Prelude
    My best code is written with the delete key.

  10. #10
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    I thought 11 was worded oddly, but the only one I thought was off-base was 3, where she said that putting a command after an if was not as clear as under. I find that when an if binds only to one command to which it is logically connected, it is better to put it right after.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Funny Windows Error Codes (I rofled...)
    By Sentral in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 06-01-2006, 10:38 AM
  2. funny things
    By Benzakhar in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-10-2004, 11:06 AM
  3. funny sigs
    By Geo-Fry in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-23-2003, 10:59 PM
  4. Object Oriented - Funny story
    By MethodMan in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 09-26-2002, 03:21 PM
  5. For some reason, it prints funny characters ???
    By Nutshell in forum C Programming
    Replies: 8
    Last Post: 01-14-2002, 04:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21