I recently found one of my fellow programmers wrote something like:
int foo()
{
//some code
{
//some code
}
//some code
{
//some code
}
//some code
}
As you can see, the two inner pairs of curling braces serve only to logically separate two blocks of code. Although I have written C for some time, I never really saw such style. Is this considered a good, or, at least, an acceptable style in C?
I don’t think this is a particularly good style – it superfluously increases indentation, leaves less space for a line and in parallel, it decreases readability. If you have several “logic modules”, you can either separare them using an empty line, like
etc. Or, if you have large chunks of code, you should consider refactoring it and breaking them up into separate functions.