Some help!!!!

This is a discussion on Some help!!!! within the C++ Programming forums, part of the General Programming Boards category; I am starting to prefer Code: #ifdef USE_DEBUGGER # if x # if y # define L 2 # else ...

  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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,720
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    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
    21,720
    Bah, you people just do not know how to appreciate style
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21