Thread: Some help!!!!

  1. #16
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I am starting to prefer

    Code:
    #ifdef USE_DEBUGGER
    #  if x
    #     if y
    #        define L 2
    #     else
    #        define L 3
    #     endif
    #  else
    
    Ok well you get the idea
    [/code]

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Yeah, that works too, but again... manual indentation.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > I do not know how come its still in such wide-spread use.
    Much better dev-c++ than some positively prehistoric TurboC
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Elysia
    Can't actually see how you like that
    For example:
    Code:
    if (x == 0)
    {
        foo();
    }
    else if (x == 1)
    {
        bar();
    }
    else
    {
        baz();
    }
    
    switch (x)
    {
    case 0:
        foo();
        break;
    case 1:
        bar();
        break;
    default:
        baz();
    }
    I do not see it necessary to indent those function calls one more level when the if/else chain is converted to a switch, unless I want to introduce a block for local scope.
    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. #20
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    >> Much better dev-c++ than some positively prehistoric TurboC

    True, I do see occassional usage of some ancient compilers. Or even reaaaaaaaally old versions of gcc.

    To laserlight: I personally just don't like how it looks. And like most programmers I am very obsessive about these things.

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by master5001 View Post
    To laserlight: I personally just don't like how it looks. And like most programmers I am very obsessive about these things.
    Same here, and it would seem very weird and/or messed up if you did introduce local scopes in those cases, as you did mention.
    Perhaps it's because I see those "case" as code, clearly belonging inside the actual scope of the switch.
    I also like local scopes with cases, and generally, I put the break inside the scope.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    That is another thing. When you do introduce local scope to a case statement it usually reverts it back to retardo indentation.

  8. #23
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Oh yes, I remember that adding the colon (:) after the case will revert it to its original position in the switch. That's retarded.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Bah, you people just do not know how to appreciate style
    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

  10. #25
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I never claimed that I did

Popular pages Recent additions subscribe to a feed

Tags for this Thread