Thread: Class with pointer to same class

  1. #16
    Registered User taelmx's Avatar
    Join Date
    Oct 2006
    Should you cut a sandwich in horizontally or diagonally?

  2. #17
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    > Thanks for all the help everyone, one more piece of the C++ puzzle clear in my head, eventhough its now polluted somewhat with sandwich annolgies .

    Well, being a wet blanket and not getting into the sandwich debate, I would advise you to always declare your variables one per line and use * and & next to the type, instead of the identifier.

    int* somename;
    int& someothername;
    int yetanothername;
    The above has the advantage of quickly bringing out the real type of the name. It also doesn't hide from your skimming routine the names that have been declared.

    int *somename, *someothername, yetanothername;
    May look fancy, but makes it harder to read when skimming the code trying to find the type of some variable 100 lines below.

    int *somename;
    is ok of course. But when seen alone. In function declarations, for instance can easily hide the real type when reading the code quickly.

    Just my opinion. Whatever yuou do, the real advise is... be consistent.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #18
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Should you cut a sandwich in horizontally or diagonally?
    I usually don't cut them.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Initializing a pointer in a class.
    By gpr1me in forum C++ Programming
    Replies: 3
    Last Post: 03-22-2006, 03:05 PM
  3. class passing a pointer to self to other class
    By daioyayubi in forum C++ Programming
    Replies: 3
    Last Post: 09-05-2005, 09:25 AM
  4. base class pointer problems
    By ... in forum C++ Programming
    Replies: 3
    Last Post: 11-16-2003, 11:27 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM