3 ms·
I agree. But your last example won't compile anyway. Though this would: if (true) foo(); else bar(); baz(); But I have to admit if you ever ac
by hacker_9 11y ago
I agree. But your last example won't compile anyway. Though this would:
if (true)
foo();
else
bar();
baz();
But I have to admit if you ever actually do that, you have failed to fundamentally understand how your code is executed. No braces means one statement. Period.
In these cases languages which are auto formatted (C#, go-fmt, etc) likely have an advantage where these problems stick out more obviously.
- Coding_Cat 11y agoBut I have to admit if you ever actually do that, you have failed to fundamentally understand how your code is executed I would say I have a pretty good understanding of how C & my code in general works, I'm currently trying to create a threadpool with support for co-routines/yielding to other threads in userspace. Nothing super fancy, but not something you can do without understanding how code is actually executed ;) But I still lost an hours work last week because I hadn't put a brace after an if statement and when I came back to it, I didn't notice the lack of braces and put an extra statement behind it. This is why I usually stick to putting braces around everything.