Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: autoload with explicit path



Peter Stephenson wrote on Thu, Jan 12, 2017 at 15:59:20 +0000:
> On Thu, 12 Jan 2017 15:40:57 +0000
> Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > We could also put these two members in a union{} if they are mutually
> > exclusive (if at least one of them is NULL at all times).
> 
> They are mutually exclusive, as one is only useful for an autoload and
> one is only useful with real source, which is why it uses the same
> pointer.  Making it a union doesn't actually change anything: it's still
> the same set of of reads and writes.

Of course it would be exactly the same machine code, but the source code
would be more robust against bugs.  It's a lot harder to refer to the
wrong union member than to use the ->filename member without testing
PM_LOADDIR first.



Messages sorted by: Reverse Date, Date, Thread, Author