Almost all the code I've seen until now uses the following style for curly braces:
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
Visual Studio also defaults to this. However I have read Code Complete 2nd edition and Steve McConnell argues against this style. "Avoid unindented being-end pairs (...) Although this approach looks fine, it (...) doesn't show the logical structure of the code. Used this way, the begin and end aren't part of the control construct, but they aren't part of the statements after it either." Steve McConnell recommends using the pure block style, which emulates Visual Basic (where there's no curly braces):
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
or this (begin-end block boundaries):
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
Although I tend to agree with McConnell's reasoning, all the books I read, the classes I attended, and Visual Studio, use the first style, so I find it a bit weird. What do you think?
New PowerToys update fixes memory leaks and other issues by Taras Buria
Another bug-fixing update is available for PowerToys version 0.100. After releasing version 0.100.1 with a bunch of bug fixes and patches, Microsoft pushed version 0.100.2 to address two important issues with one of Command Palette Dock's features. With PowerToys 0.100.2, Microsoft fixed the performance meter displaying incorrect values and memory leaks, which are particularly unwanted things in the current situation with overpriced PC hardware.
Here is the changelog:
Reverted a Performance Monitor dock refresh change that forced item refreshes on every metric update
Fixed a memory leak in the Performance Monitor dock extension by reusing stable network upload/download band items instead of creating new list items on each refresh
For those unfamiliar, Command Palette Dock is a relatively new addition to PowerToys. It is a taskbar-like tool that you can keep on top of the screen to pin various useful widgets, commands, and more. It can display time, weather, your PC's performance metrics, and more. Microsoft introduced the Command Palette Dock in March 2026 in PowerToys 0.98. Microsoft has dedicated documentation for Command Palette Dock, and you can check it out on the official Microsoft Learn website.
You can update PowerToys to the latest version by going to Settings > General and clicking "Check for updates." Alternatively, you can download the installer from GitHub using this link.
In other news, Microsoft is working on a new window-management utility for PowerToys. Called Alt Window Cycle, it will let you use the Alt + ` shortcut to switch between different windows in a single app. You can learn more about the tool here.
You did take leaf out of Trumps book already and had brexit - only to harm yourself. The same goes with this AI nonsense. The obvious solution for these companies is to move their head office to Brussels. I can see quite much irony there... 🙂
Wonder if they are trying to slow down Linux traction (not saying this is the only factor) in the consumer space. With the most pressure probably being steam deck/box, etc.
Question
Andre S. Veteran
Almost all the code I've seen until now uses the following style for curly braces:
void swap(int &a, int &b) { int temp = a; a = b; b = temp; }Visual Studio also defaults to this. However I have read Code Complete 2nd edition and Steve McConnell argues against this style. "Avoid unindented being-end pairs (...) Although this approach looks fine, it (...) doesn't show the logical structure of the code. Used this way, the begin and end aren't part of the control construct, but they aren't part of the statements after it either." Steve McConnell recommends using the pure block style, which emulates Visual Basic (where there's no curly braces):
void swap(int &a, int &b) { int temp = a; a = b; b = temp; }or this (begin-end block boundaries):
void swap(int &a, int &b) { int temp = a; a = b; b = temp; }Although I tend to agree with McConnell's reasoning, all the books I read, the classes I attended, and Visual Studio, use the first style, so I find it a bit weird. What do you think?
Link to comment
https://www.neowin.net/forum/topic/630296-curly-braces-placement-and-indentation/Share on other sites
63 answers to this question
Recommended Posts