:: Re: [DNG] "Common knowledge?"-quest…
Góra strony
Delete this message
Reply to this message
Autor: Rainer Weikusat
Data:  
Dla: karl
CC: dng
Temat: Re: [DNG] "Common knowledge?"-question
karl@??? writes:
> Reiner Weikusat:
>> Peter Olson <peabo@???> writes:
>>
>> >> On January 23, 2016 at 1:36 PM Rainer Weikusat
>> >> <rainerweikusat@???> wrote:
>> >>
>> >> Peter Olson <peabo@???> writes:
>> >> 5>> On January 22, 2016 at 4:34 PM Rainer Weikusat
>> >> <rainerweikusat@???> wrote:
>> >>
>> >> [...]
>> >>
>> >> >>     p = buf = alloca(total);

>> >>
>> >> [...]
>> >>
>> >> > the failure mode of alloca is SIGSEGV or some other malfunction and
>> >> > there is no way to test for it
>
> You should be able to cache a SIGSEGV if you are useing sigaltstack().
> Never tested it though and don't know it it is useful at all.
>
> ...
>> In this respect, there's no difference between alloca and static stack
>> allocations.
> ...
>
> Soo, the above is nearly the same as
>
> char buf[total];
> p = buf;
>
> Why then use alloca()?


This obviously cuts both ways: Considering that C99 style variable
arrays share all the (largely hypothetical) drawbacks of alloca but
offer less features, why use them?