[EMAIL PROTECTED] writes: > On a whim I tested something the other day, which appears to work with > g++ 3.3.4.
Yes, this works with other versions of gcc as well. > Unfortunately it sometimes appears to exhibit flaky > behavior when statically linking... Static linking is bad for many reasons, and you shouldn't be doing unless you really really know what you are doing. But "random" crashes on the same machine on which the binary was built is not one of these reasons. > (i.e. mysterious segfault on the > line following the declaration of the array). To reproduce this, it would help to know exactly what OS you are using, and exactly how you built this static exe. If may also help to know for which values of "i" you observed the crash. If the OS is Linux, knowing whether exec-shield is on and randomize_va_space are on may also give a clue. > class Foo This isn't a compilable test case. In the future, please post *complete* tests. > In the above program the function "test" will dynamically create an > array "foo" with "i" elements, [on stack] > which gets freed automatically upon exit of the function. It doesn't get "free"d, but goes out of scope (just like any other local variable). Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus