"goto", is it a taboo?

This is a discussion on "goto", is it a taboo? within the C Programming forums, part of the General Programming Boards category; my tuppence on the C programming correspondance course i did, i received half- marks for using a goto !!! i ...

  1. #16
    My diaper's full....... stevey's Avatar
    Join Date
    Nov 2001
    Posts
    759
    my tuppence

    on the C programming correspondance course i did, i received half- marks for using a goto !!! i thouight this was well extreme and complained. they said it demonstrated unstructured programming and wouldn't change the marks.

    the course notes said " goto can be used to create quick routines, but its use can never be considered necessary "

    "goto statement implies bad programming skills and lack of structered design. however you may find goto is an acceptable method of bypassing a particular section of code rather than designing some convoluted logical test to avoid its use"

    also said "goto has inherent problems".

    so i don't think they were especially sure about it !! but i think all these quotes are fair comment. (from my own limited experience)
    Steve

  2. #17
    Registered User
    Join Date
    Feb 2002
    Posts
    591
    Well the way I see it is that it is in the standard and thats for a reason. I also think that if you really know what you are doing(I am not) you probably will have rare cases where goto will do good. But no one on this board(except 0ne or two) should use it. I have never seen a case where I have to use it or where it will be clearer to use it. But I think it is wrong to say that it always is 100% wrong o use goto. Goto have a justified place in the C language.

  3. #18
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Lightbulb

    I have a read a copy of the reports released the ANSI X3J11 responsible for standardizing C.

    It said there that goto was placed there just for convention, since C is not very far from Assembly. The committee also recommended that its used be avoided or minimized. Otherwise, the block structure of functions will no longer be important since goto will and can jump to any line in the code considered.

    In Assembly maybe, goto is important for performance. But we are talking C and C++ here and you rarely see complex software projects written in largely in Assembly.

    Lastly, C's elegance has mainly been appreciated because it promotes readability and modularity (thanks to the gotoless programming philisophy.)
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "goto" question
    By Kylecito in forum C++ Programming
    Replies: 29
    Last Post: 02-15-2006, 05:46 AM
  2. I know everyone hates "GOTO" but...
    By anderson in forum C++ Programming
    Replies: 15
    Last Post: 02-13-2006, 10:08 AM
  3. when to use a "goto"
    By mitiwi in forum C Programming
    Replies: 1
    Last Post: 03-08-2005, 10:42 PM

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