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

Re: type-checking for metafiedness? (was: Re: Cores almost on demand in patcompile())



On Tue, 11 Oct 2016 06:51:05 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Pardon me if this has been discussed before, but why don't we introduce
> the type definitions
> .
>     struct metafied_t { char *v; };
>     struct unmetafied_t { char *v; };
> .
> and start incrementally replacing uses of "char *" with uses of these
> types?  This will gain type checking for metafied v. unmetafied strings,
> as these two types do not implicitly convert into each other (attempts
> to do so generate a compiler warning).

This probably is a good idea, although the intermediate state where this
has been only partly done is likely to be a bit of a mess.  Modern
compilers should be able to keep this working efficiently.

Some thought could be given as to whether the unmetafied structure should
contain the length, too.  The only uses of unmetafied strings I can
think of that wouldn't need it are at the library / system interface,
which requires unmetafied null-terminated strings.

pws



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