gmqcc/tests/pointlife.qc

20 lines
455 B
C++
Raw Normal View History

2013-01-07 18:09:15 +00:00
var float foo = 0;
void funcall() {}
void bar(string) {}
void main(string str) {
2013-08-27 10:41:03 +00:00
string pl;
2013-01-07 18:09:15 +00:00
2013-08-27 10:41:03 +00:00
if (foo)
return; // this is a block wher 'str' doesn't live
// so the point-life will not overlap with str
pl = "Got overwritten!\n"; // pl point-life
2013-01-07 18:09:15 +00:00
2013-08-27 10:41:03 +00:00
print(str);
2013-01-07 18:09:15 +00:00
2013-08-27 10:41:03 +00:00
pl = "Kill the lifrange here"; // pl life stops
funcall(); // Now lock pl in case we have -Oglobal-temps
bar(pl); // pl life starts here now
2013-01-07 18:09:15 +00:00
}