Fixing the Indentation draft

This is a discussion on Fixing the Indentation draft within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Originally Posted by citizen >> Oh and n++ is not the same as ++n We know. But the behavior difference ...

  1. #46
    Amazingly beautiful user.
    Join Date
    Jul 2005
    Location
    If you knew I'd have to kill you
    Posts
    254
    Quote Originally Posted by citizen View Post
    >> Oh and n++ is not the same as ++n

    We know. But the behavior difference is basically the only reason to prefer one or the other, especially considering looping. Nevertheless, people will look at n++ in a for loop and be like "damn you're not optimizing and writing code at the same time! Shock and horror!"
    Just for the sake of keeping a flamewar going, it can be a good habit to use ++n within loops, not for performance reasons, but because of iterators. Although all of the standard iterators will be fine with n++, some custom written iterators do not implement the copy constructor, and thus ++n will work, while n++ will not compile. Thus, ++n everywhere enforces consistency.
    Programming Your Mom. http://www.dandongs.com/

  2. #47
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,414
    I find the point moot. Since ++n and n++ does different things, there are times when you will avoid from using the same syntax. It's also a matter of opinion, because a few construction/destruction/copying of objects isn't going to hurt performance very much unless done very much.
    So I usually say go with whatever you fancy and don't worry about it.
    And btw, things lacking a copy constructors such as iterators are broken (things which should allow to be copied).

    Now, back to the indentation or coding style draft.
    Last edited by Elysia; 02-23-2008 at 10:18 AM.
    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. #48
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,328
    Although all of the standard iterators will be fine with n++, some custom written iterators do not implement the copy constructor, and thus ++n will work, while n++ will not compile.
    I think those custom iterators need to be fixed.
    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

Page 4 of 4 FirstFirst 1234
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 05-23-2009, 06:20 PM
  2. Indentation in Code::Blocks
    By PING in forum Tech Board
    Replies: 8
    Last Post: 03-26-2008, 03:33 PM
  3. setting indentation in dev-c++
    By richdb in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 06-12-2006, 08:03 PM
  4. Fixing my (Stupid) IE Menubar
    By civix in forum Tech Board
    Replies: 2
    Last Post: 01-04-2004, 01:22 AM
  5. Fixing Laptops
    By zdude in forum Tech Board
    Replies: 5
    Last Post: 06-16-2003, 01:56 AM

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