Thread: To Hodor

  1. #1
    Registered User Ivory348's Avatar
    Join Date
    Oct 2019
    Posts
    75

    To Hodor

    Hodor: why are my responses to your posts being blocked? Is that the way in which you conduct your discussions?

  2. #2
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    I am not aware of them being blocked. If they are indeed being blocked -- and I find that hard to believe since I have not put you on ignore -- then it has nothing to do with me

  3. #3
    Registered User Ivory348's Avatar
    Join Date
    Oct 2019
    Posts
    75
    Hodor: I have had a prior number of equally daunting experiences - like your unpleasant response - using C Board. (I have had excellent responses as well! That is why I pluck up courage now and again, when I need to write in C, and have a query, to place a post.) The code I posted *worked*, only a particular strcpy in it didn't. That was what my query was about.

    Just a word about using gotos: (now I have a chance to do so) if using gotos makes it possible to create a routine with very few lines, and it is well structured, and works, and it is transparent, I see no reason why not to do so. Imo a coding language is not a religion. It is a means to an end: no more.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Ivory348
    if using gotos makes it possible to create a routine with very few lines, and it is well structured, and works, and it is transparent, I see no reason why not to do so. Imo a coding language is not a religion. It is a means to an end: no more.
    That's true, but if you're writing well structured code with goto, it is usually the case that you can replace the goto with a specific control structure or helper function, thereby making your intentions clearer. The common exceptions to this in C would be using goto to keep error handling in one place (DRY principle: Don't Repeat Yourself), usually at the end of the function, or to break out of nested loops without introducing a flag purely for that purpose (but sometimes a descriptive flag can clarify the code).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User Ivory348's Avatar
    Join Date
    Oct 2019
    Posts
    75
    Quote Originally Posted by laserlight View Post
    That's true, but if you're writing well structured code with goto, it is usually the case that you can replace the goto with a specific control structure or helper function, thereby making your intentions clearer. The common exceptions to this in C would be using goto to keep error handling in one place (DRY principle: Don't Repeat Yourself), usually at the end of the function, or to break out of nested loops without introducing a flag purely for that purpose (but sometimes a descriptive flag can clarify the code).
    Yes there is always a but. But the but might not be relevant.

  6. #6
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by Ivory348 View Post
    Yes there is always a but. But the but might not be relevant.
    In your original code the use of multiple gotos was not appropriate and it was certainly not needed. The use of goto in what you pasted obfuscated the code and made it unreadable spaghetti code. So, yes, I could not excuse the use of multiple goto like you asked us to because it made no sense. There are exceptions where goto is appropriate of course (especially in C where gotos are local jumps. But using goto to make a loop is not one of the commonly accepted uses)

    Edit: Anyway, why are we discussing this here?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Hodor View Post
    Edit: Anyway, why are we discussing this here?
    Well, it is the C programming forum... you just have the honour of being the user this thread is named after
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    338
    C has now become a widely used professional language for various reasons.
    C is much more flexible and free-wheeling. This freedom gives C much more power that experienced users can employ.
    Its main drawback is that it has poor error detection which can make it off putting to the beginner. However diligence in this matter can pay off handsomely since having learned the rules of C we can break them. Not many languages allow this. This if done properly and carefully leads to the power of C programming.
    C Basics
    "without goto we would be wtf'd"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hodor's Opinion Concerning Cross-Posting
    By Hodor in forum General Discussions
    Replies: 8
    Last Post: 12-29-2015, 03:56 PM
  2. Hodor Wears Shoes
    By Hodor in forum C Programming
    Replies: 19
    Last Post: 11-24-2013, 07:20 PM
  3. Hodor Can Multiply
    By Hodor in forum C Programming
    Replies: 16
    Last Post: 11-22-2013, 04:53 AM
  4. Hodor Can Divide
    By Hodor in forum C Programming
    Replies: 1
    Last Post: 11-22-2013, 04:41 AM

Tags for this Thread