I am super dumb.

Discussion in 'General Software Discussion' started by blix9, Mar 16, 2003.

  1. Malus

    Malus BSD SMASH!

    Joined:
    May 13, 2002
    Messages:
    1,170
    Likes Received:
    3
    Trophy Points:
    0
    You guys are thinking too hard about this program; he made an infinite loop. Obviously, x is always going to be greater than or equal to zero, so the return 0 will never execute. That's what Uberlord was commenting on.

    Usually, returning a number is good for debugging and properly making commands for Unix, especially if you want something that can be piped. AFAIK, it returns 0 when the program runs successfully, and returns something else when there's a problem. Of course, you have to determine what to return if the program fails, so you have make other values that you can return.

    And no, you shouldn't learn about classes first. You really have to learn the basic syntax and the usage of functions before you go onto class, structs, and dynamic memory allocation.
     
    Last edited: May 18, 2003
  2. mike2h

    mike2h New Member

    Joined:
    Nov 11, 2002
    Messages:
    6,359
    Likes Received:
    69
    Trophy Points:
    0
    :hmm: :hmm: :confused: :eek: :dead: that was me programing. beat that! :D
     
  3. UberLord

    UberLord A Legend in Underwear

    Joined:
    May 8, 2002
    Messages:
    5,255
    Likes Received:
    4
    Trophy Points:
    0
    This infact is Good Programming Practice™ as it's a handy indicator if the code crashed or not. OK, with some languages you get good exception handling so it can be a non-issue, but for VB programmers (which is my main language), its exception handling sucks blows and chews so returning a simple boolean from simple functions and passing return values byref as an argument can lead to a much more error free and reliable system.
     
  4. Malus

    Malus BSD SMASH!

    Joined:
    May 13, 2002
    Messages:
    1,170
    Likes Received:
    3
    Trophy Points:
    0
    And the time you can save from doing less debugging will do marvels for you. :)
     
  5. caqde

    caqde Active Member

    Joined:
    Oct 21, 2002
    Messages:
    507
    Likes Received:
    8
    Trophy Points:
    28
    Dubugging -> Easiest way to recieve a migrane especially when you were not the one that made the program you're dubugging. Even worse is when the program actually runs and you need to dubug it. Always great to know that there is an error but you are not quite shure where it is, but it has to do with this region of code. :D
     
  6. ToshiroOC

    ToshiroOC Unbiased.

    Joined:
    Jun 30, 2002
    Messages:
    4,812
    Likes Received:
    1
    Trophy Points:
    0
    "supposed to"... oops :duh: :D
     

Share This Page

visited