stops compiling

Walter Bright newshound at digitalmars.com
Thu Mar 23 17:40:01 PST 2006


"Brad Roberts" <braddr at puremagic.com> wrote in message 
news:Pine.LNX.4.64.0603230012080.5795 at bellevue.puremagic.com...
> On Wed, 22 Mar 2006, Walter Bright wrote:
>> No, I didn't increase the stack size. I put in an exception handler for 
>> the
>> stack overflow exception. It still quits, it just gives a message first.
>
> Did you check the results on linux?  That sounds like you're catching a
> structured exception under windows that doesn't have an analog under any
> unix system.

Yes, that's exactly what's done. I don't know what the linux analog is.

> Too bad it's not actually making it so it's capable of handling a
> seriously long function.. in some auto-code generation scenarios this
> isn't that odd a case.  I see it come up from time to time on the gcc
> developers list.  Obviously, failing gracefully is better than failing
> catastrophically, but it's still failing.

The algorithms used in the compiler are fundamentally recursive, which means 
they use stack. I could bump up the stack, but then it's just a longer 
function that fails. The trouble is, you must decide *in advance* how much 
stack space to allocate (it's not like malloc/realloc). Once you run out, 
there's no recovery.

The only thing to do is pick a reasonable size, that will cover all but 
extreme cases, and error out on the rest. 





More information about the Digitalmars-d-bugs mailing list