This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Is there any way to give a warning when a nested function use its parent function's local variable value.
- From: xinglp <xinglp at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 23 Nov 2014 14:25:52 +0800
- Subject: Is there any way to give a warning when a nested function use its parent function's local variable value.
- Authentication-results: sourceware.org; auth=none
Such as this code
void foo(int x)
{
int a;
void foo2(int i)
{
// I want warning for the below code.
if (i == a){}
x += i;
a += i;
}
foo2(a);
}
Because I use nested function for better code orgnization and callback. Thanks.