От: | vopl | ||
Дата: | 16.01.08 09:14 | ||
Оценка: |
#include <stdio.h>
void f2();
static int f1()
{
printf("f1\n");
f2();// тут
return 1;
}
void f2()
{
printf("f2\n");
static int stub = f1();// и тут
}
int main()
{
f2();
return 0;
}
f2
f1
f2
#include <stdio.h>
void f2();
static int f1()
{
printf("f1\n");
static int cnt(0);
if(cnt++ < 10)
{
f2();
}
return 1;
}
void f2()
{
printf("f2_beg\n");
static const int stub = f1();
printf("f2_end\n");
}
int main()
{
f2();
return 0;
}
#include <stdio.h>
struct SStatic
{
SStatic(int i)
{
printf("ctor %d, 0x%p\n",i, this);
}
~SStatic()
{
printf("dtor 0x%p\n", this);
}
};
void f2();
static int f1()
{
printf("f1\n");
static int cnt(0);
if(cnt++ < 10)
{
f2();
}
return cnt;
}
void f2()
{
printf("f2_beg\n");
static const SStatic stub = f1();
printf("f2_end\n");
}
int main()
{
f2();
return 0;
}
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
f2_beg
f1
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
ctor 11, 0x00404030
f2_end
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030
dtor 0x00404030