Thread: C++ Coding Standard Question/Discussion

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Codebot
    Join Date
    Jun 2004
    Location
    Toronto
    Posts
    195

    C++ Coding Standard Question/Discussion

    Ive been given a coding standard to follow when coding my projects. It is not set in stone yet so I would like to get some 3rd party input (you guys) on some of the rules. Any suggestions are appreciated.

    1. The dereference operator '*' and the address-of operator '&' should be directly connected to the type specifier. The rational of this is that, as an example, int* p; emphasizes type over syntax while int *p; emphasizes syntax over type. Although both forms are valid, the heavy emphasis on types in C++ suggests that int* p; is the preferable form.

    I don't quite agree with this rule because when you concatinate declarations like this:
    Code:
    int *a, *b, *c;
    you are forced to put the operator by the variable instead of the type. Else, you would have to spread all the variables out on its own line:
    Code:
    int* a;
    int* b;
    int* c;

    Whats your take on it. Discuss.
    Last edited by Mastadex; 08-13-2008 at 07:38 AM.
    Founder and avid member of the Internationsl Typo Associateion

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bug in iterator comparison in C++ standard?
    By steev in forum C++ Programming
    Replies: 14
    Last Post: 07-12-2008, 12:02 AM
  2. C/C++ standard
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 07-06-2003, 03:22 AM
  3. C++ Coding Standard
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 05-21-2003, 01:08 PM
  4. Coding Contest....
    By Koshare in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 10-14-2001, 04:32 PM
  5. standard language, standard compiler?
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 09-03-2001, 04:21 AM