zsh-workers
 help / color / mirror / code / Atom feed
From: Taylor West <krokodileglue@outlook.com>
To: Peter Stephenson <p.stephenson@samsung.com>,
	"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] remove unnecessary checks for NULL in zfree and zsfree
Date: Thu, 1 Mar 2018 13:29:13 +0000	[thread overview]
Message-ID: <BY2PR06MB22774711E031763A2245D51BB1C60@BY2PR06MB2277.namprd06.prod.outlook.com> (raw)
In-Reply-To: <20180301091511.40f12304@pwslap01u.europe.root.pri>

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

I quoted the C11 standard because it's the one I'm most familiar with, but that particular clause has been present since the first ANSI draft. In the C89 standard it's section 4.10.3.2: ``If ptr is a null pointer, no action occurs.'' Even if zsh were to rely on some variant of GNU C, no extension that I know of modifies this part of the standard. Unless you know of a particular platform with a particularly bad compiler that you want to support, I recommend taking advantage of these kinds of guarantees.
________________________________
From: Peter Stephenson <p.stephenson@samsung.com>
Sent: Thursday, March 1, 2018 1:15 AM
To: zsh-workers@zsh.org
Subject: Re: [PATCH] remove unnecessary checks for NULL in zfree and zsfree

On Thu, 1 Mar 2018 01:17:12 +0000
Taylor West <krokodileglue@outlook.com> wrote:
> According to section 7.22.3.3 paragraph 2 of the final committee draft
> of the C11 standard, if free() is passed a NULL pointer then "no
> action occurs". The current checks on `p' in zfree and zsfree are
> unnecessary---this patch removes them.

We haven't even progressed to C99 yet... zsh is designed to be defensive
about some pretty old stuff.  Unfortunately, it's quite difficult to
know when where it's still being compiled.

pws

  reply	other threads:[~2018-03-01 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  1:15 Taylor West
2018-03-01  1:17 ` Taylor West
2018-03-01  9:15   ` Peter Stephenson
2018-03-01 13:29     ` Taylor West [this message]
2018-03-01 19:45       ` Peter Stephenson
2018-03-01 21:37         ` Joey Pabalinas

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=BY2PR06MB22774711E031763A2245D51BB1C60@BY2PR06MB2277.namprd06.prod.outlook.com \
    --to=krokodileglue@outlook.com \
    --cc=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).