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())



Bart Schaefer wrote on Sat, Oct 15, 2016 at 18:14:44 -0700:
> On Sat, Oct 15, 2016 at 1:30 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Does anyone have a way to get type checking that doesn't involve
> > adding .v everywhere?
> 
> Wouldn't it suffice to use
>   typedef char *unmeta_t;
>   typedef unsigned char *meta_t;
> 

Another option: use incomplete struct types:
.
    typedef char *unmeta_t;
    typedef struct incomplete_meta_t *meta_t;

> (or the reverse if we believe we're mostly going to be working on
> meta_t).  If we do that and also enable the GCC warnings -Wtype-limits
> -Wconversion -Wformat-signedness would we not get adequate verbosity
> without changing pointer arithmetic and dereferencing?
> 
> I hadn't even considered all the places where using a struct would
> change memory allocation strategy.  Oof.
> 



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