styles vary quite a bit. I personally say that you should only add 'extra' brackets for programmatic reasons, for example if you declare a variable inside the brackets, it will destroy outside them, and sometimes that is useful with classes to invoke a destructor or to dispose of large amounts of temporary memory (hopefully you don't do this much, though). That said, extra brackets do not generally hurt so long as you are aware of their implications to code (mostly, the scope thing). The trouble with extra brackets (apart from the scope) is they mess up automatic indent tools that attempt to style the code for you, and they can confuse the reader if used randomly (like anything, if you DO go this route, be very consistent).
I would code this with some white space instead, like this (you can decide for yourself where line breaks make the most sense, the example isnt useful for decision making here).
1 2 3 4 5 6 7 8
|
Readprocessmemory(hProcess, LPVOID bla bla bla);
cout << “Display text here” << endl;
cout << “Another text here” << endl;
Do more stuff here();
cin.get();
| |
also as a rule of thumb you want to group things in functions when the code becomes 'messy'.
so if you had 20 cout statements, just wrap them in a function to clean it up, grouping them all together in one place. I know its just and example but if you had redundant text like "variable text here" ... a function reduces this to 1 line instead of 2 hard coded lines, and for large amounts of spew this really helps clean it up; there are numerous ways to deal with bulk text in code if you have it.