Thread: figuring out code

  1. #16
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by quzah View Post
    It is sort of like this discussion.

    Putting "if( 0 == var )" compared to "if( var == 0 )" is really no different than saying "value[array]" compared to "array[value]".

    There's no difference at all.

    The only reason it's "silly", or "stupid" is because you were first taught that "array[value]" was "right". Damn, have some quotation marks!

    But as far as one being better, it's just simply not so. It's purely personal preference. They're identical. There's nothing in the language to indicate one is better than the other. It's just because that's how you learned it, so that must be right.

    If you want to be silly, you could say: 0[X + Y] == *(X + Y)
    Of course, you'd still be right; they'd be equally correct, and equally as easy to understand.


    Quzah.
    I might debate the "easy to understand" part... And yes it is a matter of custom and , for the most part, it just looks wrong... and that might serve to reduce my understanding of the code, causing me to make errors... or far worse... give bad advice

    I know it doesn't actually make any difference to the compiler... But I'm not a compiler... I'm an interpreter...

  2. #17
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by CommonTater View Post
    I might debate the "easy to understand" part...
    Yeah, it would probably get ugly with multiple dimensions.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help figuring out error
    By dudeomanodude in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2008, 03:20 PM
  2. Help figuring out equation.
    By gator6688 in forum C++ Programming
    Replies: 4
    Last Post: 10-05-2007, 03:17 PM
  3. Need help figuring out what to learn
    By the dead tree in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 12-17-2004, 12:02 PM
  4. help figuring out a problem
    By kwm32 in forum Windows Programming
    Replies: 2
    Last Post: 03-20-2004, 10:47 PM
  5. Figuring Algo for assignment
    By axon in forum C++ Programming
    Replies: 4
    Last Post: 10-30-2003, 11:03 AM