Re: [dev] [style] variable declaration locations and varriable length

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Tue, 3 Mar 2015 11:11:39 +0100

> On Mon, Mar 2, 2015 at 3:56 PM, Anthony J. Bentley <anthony_AT_cathet.us> wrote:
>> VLAs are a fundamentally broken feature because they do not allow any
>> error checking. alloca() is the same.
>>
>> --
>> Anthony J. Bentley
>>
>
> But when do you ever do error checking of stack size? Is recursion a
> fundamentally broken feature because it doesn't allow any stack
> overflow error checking?
>
> -emg

The compiler can does the check each time it increment the size
of the stack. This was common in the old times, when
collisions between stack and heap were commons. Today is a
non sense. For example in linux you have a stack with a fixed
size of 8MB (by default), and when you are out of it you
receive a SIGSEGV, so it is secure to use it (secure in the
sense you are not going to trash heap with stack data).
For the example of emg, I think is correct because the size
of path and d_name are limited, and it is equivalent to
declare buf like 'char buf[FILENAME_MAX]' but using
less space in the stack, that is always good.
Received on Tue Mar 03 2015 - 11:11:39 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 03 2015 - 11:24:03 CET