Should you cut a sandwich in horizontally or diagonally?
Should you cut a sandwich in horizontally or diagonally?
> 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.
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.Code:int* somename; int& someothername; int 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.Code:int *somename, *someothername, yetanothername;
is ok of course. But when seen alone. In function declarations, for instance can easily hide the real type when reading the code quickly.Code:int *somename;
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.
I usually don't cut them.Should you cut a sandwich in horizontally or diagonally?
"The Internet treats censorship as damage and routes around it." - John Gilmore