A bug?

drug via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 15 08:11:36 PST 2017


15.02.2017 19:00, berni пишет:
> I'm not sure if this is considered a bug:
>
>> import std.stdio;
>> import std.string;
>>
>> int c = 0;
>>
>> void main()
>> {
>>
>>    try {
>>        write(++c," ");
>>        stdout.flush();
>>        int[100000] tmp;
>>        throw new Exception(format("%s",tmp));
>>    } finally
>>    {
>>        main();
>>    }
>> }
>
> Output:
>
>> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Segmentation fault
No, you recursively call main() and get segfault (due to stack overflow) 
as expected
If you downsize tmp array then you get segfault later


More information about the Digitalmars-d-learn mailing list