Thread: dont konw what to do next.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Nonconformist Narf's Avatar
    Join Date
    Aug 2005
    Posts
    174
    The fear of forgetting to include stdlib.h is probably one of the funniest excuses I've read to date
    Why? I don't know about you, but I'm not perfect. I forget to include stdlib.h all the time, and I'm also aware of legitimate problems that can occur if there's no prototype in scope for malloc. But if that doesn't do it for you, how about less typing, easier maintenance, and cleaner code? There are good arguments for both sides, but I think in general the arguments to not cast make more sense.
    Then you do not do any typecasting at all for any reason
    Am I just overly flexible to be able to see both sides of an argument and pick the most reasonable solution? Because a lot of people--like you--take what I say and mangle it to the most extreme possible interpretation. Or am I just really bad at expressing myself and nobody understands me?
    Just because I don't care doesn't mean I don't understand.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by Narf
    Why? I don't know about you, but I'm not perfect. I forget to include stdlib.h all the time, and I'm also aware of legitimate problems that can occur if there's no prototype in scope for malloc. But if that doesn't do it for you, how about less typing, easier maintenance, and cleaner code? There are good arguments for both sides, but I think in general the arguments to not cast make more sense.
    The excuse about stdlib.h is just plain silly. The same can be said about forgetting to include any other header file. In that case why typecast anything if you are that parinoid about forgetting to include one or more header files? The argument about whether to typecast malloc or not to typecast malloc can be made about typcasting any function that returns a void pointer.

    Quote Originally Posted by Narf
    Because a lot of people--like you--take what I say and mangle it to the most extreme possible interpretation.
    I just took what you said and streatched it a bit (well, maybe a lot) to illustrate a point. Some posters here appears to be very parinoid about typcasting. And parinoid for the wrong reason(s). I'm not saying anyone has to typcast, but (s)he cannot be critized for doing so. Of course, in the academic world students must comply with the coding standards set by the instructor(s), and in the real world programmers must comply with the company's coding standards (hopefully they have them!).

    This is my last post on the topic. Good discussion that did not digress into namecalling like one of the other recent threads

  3. #3
    Nonconformist Narf's Avatar
    Join Date
    Aug 2005
    Posts
    174
    Good discussion that did not digress into namecalling like one of the other recent threads
    I will never resort to namecalling. And you shouldn't cut a stimulating debate short because you're afraid of that.
    The same can be said about forgetting to include any other header file.
    Yes. Yes it can. But the problem still exists whether you're talking about malloc() or do_my_foo() in slaphappy.h. I think you're missing my point. I don't typecast at first so that I can weed out common errors like forgetting a header. Then I add casts as needed to get a clean compile. Why waste time looking for bugs when the compiler can do the work for you? I'm not against casting by any stretch of the imagination, and I'm often caught casting my malloc(). What I am against is blindly casting--or not casting--without a thought.
    Some posters here appears to be very parinoid about typcasting.
    Probably the same ones that are paranoid about goto.

    Well, I suppose this conversation is over since that was your last post and I can't respond to nothing. Cheers!
    Just because I don't care doesn't mean I don't understand.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    9

    thank u everybody

    it was only a simple while()
    in the main function.

Popular pages Recent additions subscribe to a feed