:: Re: [DNG] Starting outline for the …
Página Inicial
Delete this message
Reply to this message
Autor: Hendrik Boom
Data:  
Para: dng
Assunto: Re: [DNG] Starting outline for the DNG Safe Programmer Certificate
On Fri, Jul 30, 2021 at 03:33:05PM +0200, Enrico Weigelt, metux IT consult wrote:
> On 30.07.21 00:32, Josef Grosch via Dng wrote:
>
> > Global variables are a disaster looking for a place to happen, avoid at
> > all cost. The scope of variables should be as small as possible.
>
> it depends ... for small programs where you really *know* (by
> definition) there really may only be one instance of that data, it might
> be actually the better solution - in that case you know the working set
> for sure (size of .data). This is the kind of programming where you also
> rely on the OS (kernel, supervisor, container, ...) doing all post
> termination cleanups.
>
> Many Plan9 programs are written in that way - they're so damn small that
> they just don't need much function local (or even dynamically allocated)
> data.


If the program is that small, global variables already satisfy the "as
small as possible" convention.

-- hendrik