Talk:Code Style

Math and stuff

There are other operators that may need a style enforced on them.

The following should be straightforward.

 x = foo::bar;
 x = foo->bar;
 x = foo.bar;
 ++foo;
 bar--;
 x = foo[bar];
 x = -foo;
 x = !foo;
 x = ~foo;
 x = *foo;
 x = &foo;
 delete[] foo;

But what about C casts?

 x = (foo)bar;
 x = (foo) bar;

Or go C++ all the way with casts? I personally don't like the noise C++ casts add even though they might help catch an error early while writing code.

--Boolsheet 20:07, 26 June 2012 (BST)

Control blocks

What about situations where the blocks have mixed one- and multi-liners? Should it always use braces?

 if (foo)
     bar;
 else
 {
     moreFoo;
     moreBar;
 }


 if (foo)
 {
     bar;
 }
 else
 {
     moreFoo;
     moreBar;
 }

There's also the temptation of packing everything together on one line if it is very short.

 if (foo) return 0;
 if (foo)
     return 0;

--Boolsheet 20:07, 26 June 2012 (BST)

Pointer affinity

I didn't expect that change. Why would you want to make it look like an indirection or address-of? Then again, personal preference.

--Boolsheet 02:10, 28 June 2012 (BST)