zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: type-checking for metafiedness? (was: Re: Cores almost on demand in patcompile())
Date: Tue, 18 Oct 2016 12:36:47 +0100	[thread overview]
Message-ID: <20161018123647.2f918189@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <alpine.LRH.2.00.1610151812300.4693@toltec.zanshin.com>

On Sat, 15 Oct 2016 18:14:44 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Wouldn't it suffice to use
>   typedef char *unmeta_t;
>   typedef unsigned char *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?

-Wformat-signedness didn't exist when I tried (old version, 4.5.1), but
adding -Wtype-limits and -Wconversion produced 2348 type conversion
errors and 63 implicit conversion of negative integer errors.

But we don't need new warnings --- compilers, including gcc, are much
more finnicky about converting pointer types than the base types, and
assigning individual characters from strings around isn't part of our
problems (except where we alrady have the STOUC() hack).

The only possible subtlety is on some systems char is already unsigned.
However, it seems gcc considers all three of "unsigned char *", "signed
char *", and "char *" as distinct pointer types and making meta_t either
of the first two throws up errors like:

ptr.c:11:9: warning: comparison of distinct pointer types lacks a cast

So this looks workable.  Obviously this means continuing to keep
unmetafied lengths separate.

pws


  parent reply	other threads:[~2016-10-18 11:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161016014741eucas1p189be6c2fa19aaf9d31733cae5f716178@eucas1p1.samsung.com>
2016-10-16  1:14 ` Bart Schaefer
2016-10-16 17:03   ` Daniel Shahaf
2016-10-18 11:36   ` Peter Stephenson [this message]
2016-10-09  9:00 Cores almost on demand in patcompile() Sebastian Gniazdowski
2016-10-09  9:16 ` Sebastian Gniazdowski
2016-10-09 10:15   ` Sebastian Gniazdowski
2016-10-09 16:09     ` Sebastian Gniazdowski
2016-10-10 15:31       ` Sebastian Gniazdowski
2016-10-11  2:46         ` Bart Schaefer
2016-10-11  6:51           ` type-checking for metafiedness? (was: Re: Cores almost on demand in patcompile()) Daniel Shahaf
2016-10-13 10:22             ` Peter Stephenson
2016-10-13 13:46               ` Bart Schaefer
2016-10-14  6:36                 ` Daniel Shahaf
2016-10-14 16:53                   ` Peter Stephenson
2016-10-14 17:28                     ` Bart Schaefer
2016-10-14 20:08                     ` Daniel Shahaf
2016-10-14 23:04                   ` Oliver Kiddle
2016-10-15  8:30                     ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161018123647.2f918189@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).