question about design and returning values from function.

Discussion in 'C Programming' started by gdotone, Sep 4, 2013.

  1. On Thu, 12 Sep 2013 13:15:22 +0200, Rosario1903

    In evaluating poker hands, the suits have the same value. The hand is
    a tie. Each takes half the pot. If the pot is odd, it is an informal
    custom for the "higher suit" to take the odd chip. In other places,
    the chip is left in the pot for the next hand or given to the dealer
    as a tip.
    Barry Schwarz, Sep 12, 2013
    1. Advertisements

  2. gdotone

    Geoff Guest

    Ah, Rosario and his substitutions again. Reminds me of elementary
    school when we made up our own ciphers or alphabet just for fun.
    Geoff, Sep 13, 2013
    1. Advertisements

  3. gdotone

    Hans Vlems Guest

    I like variety too Rosario, but if one asks for support it sure helps to
    clarify the issue :)
    Hans Vlems, Sep 13, 2013
  4. I like not to have an "else" when the "if" always returns. You just don't need it!

    I like to catch the quick cases (like invalid arguments and special or easycases) early in the function and return. This lets you settle upon your main algorithm in the body knowing, for instance, that you won't be dividing by zero or running a loop with first > last.

    In most cases, once I have passed through the argument validation and easy case filter phases, I will accumulate an answer and return only at the end.I do make exceptions to this when I run into "Oh shit!" situations, those that can only arise by interactions with other entities.

    So, my style is "One Entry. One Exit after filter".

    This is, however, a matter of style.
    Michael Angelo Ravera, Sep 18, 2013
  5. gdotone

    Rosario1903 Guest

    see no one but me like this argument i not post the final version,
    afther i found some other bug...
    Rosario1903, Sep 22, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.