Is there any advantage or disadvantage of using a C block scope in a function or specifically inside an Interrupt Handler?
From the link - http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472i/CJAIIDCG.html - Refer stack usage.
In general, you can lower the stack requirements of your program by:
Advantage or disadvantage in using the C block Scope is not very clear.
If you write:
{
int foo[1000];
int bar[1000];
… code that uses foo …
… code that uses bar …
}
then foo and bar exist for the entire block and must use different memory. (The compiler/optimizer may recogize they are not used simultaneously and arrange to use the same memory, but various things can interfere with this, so you cannot rely on it.)
If you write:
{
{
int foo[1000];
… code that uses foo …
}
{
int bar[1000];
… code that uses bar …
}
}
Then foo and bar only exist at different times, so the compiler can use the same memory for them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With