Why sometimes C code gets wrapped with curly braces without declaring a variable in them?
e.g. (from FreeRTOS source code, file 'tasks.c'):
portENTER_CRITICAL();
{
xTicks = xTickCount;
}
portEXIT_CRITICAL();
views:
119answers:
2
+4
A:
This is just an inner scope. The benefit is that code shows your intent in that case. e.g. This scope is the critical section.
AraK
2010-01-29 14:17:12
+4
A:
There is no need to use curly braces like this, but it helps readability.
It's a choice of style by the author, I suppose :)
sergiom
2010-01-29 14:17:44