Hey everyone, once agin today I will write about coding styles, and to be more precise, my coding style. Everyone has their own code structure methods etc. But let me describe some of mine: - Inline closing curly bracket - Tabbed variables and types - Code structured so there are close to none global variables(not counting classes) I chosed the first one because its propably the thing I see people do differently. And why do I even do it? Well, its actually to save lines. I have seen some C# code in the past that had its classic syntax. And it was close to unreadable, since simple condition instead of 2-3 lines takes 5-6, therefore you have to scroll trough more text, and that makes bad productivity, since using mouse/trackpad makes the efficiency of moving around the code terrible, and the arrows with PgDown or PageUp are not much better. For example, look at these two examples: This is the one i would use: #include int main(){ char c; std::cin >> c; if(c == 97){ std::cout << "You pressed a key"; return 0; }return 1; } As you can see, the code is small, and understandable. Now, lets look at the other coding style #include int main() { char c; std::cin >> c; if(c == 97) { std::cout << "You pressed a key"; return 0; } return 1; } So, as you can see the number line almost doubled, and its less readable. Now lets look at the second example point: Tabbed variables & types By this, i mean formating the variable type and name propertly, so they start at the same position, if possible. For example, compare these two: int number; short index; Atleast for me, this is preety badly readable, thats why i do this: short index; int number; As you can see, I have formated it the way that all the names start at the same position, and the shortest string is at the start. This way its more readable(I think). The third point is about using only few or none global variables. Why? Mostly, because its insecure and memory eating. When you have a global variable like this: #include... int globalVariable = 10; In higher level programming languages, the garbage collector may not know, if the variable is going to be used in the future and therefore, keeps it. And why is it insecure? Lets say theres a company code like this: uint64_t key = 29058201; Right now, the key is a global variable, which means you have no idea where can it be used (in case of cpp and c esspecially in header files) Someone can just come, and edit some file that everyone knows not to touch, and edits it the way that the key is automatically sent as soon as the program starts. Now, when you find out about the leak and try to fix it, you have to come trough every single piece of code in the possibly multi-gigabyte codebase, which will be pain. The last thing is, when you try to reuse the function, you have to keep in mind that you have to copy over the global variable too, since without it it wont work, and you might spend hours finding it. Conclusion: These were just example coding styles, and if you wanna blame me for what i said, go ahead. You would just have to somehow manage to contact me, which I doubt you will know how. See you.. somewhen.