From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Casting NULL pointer
Date: Sun, 30 Aug 2015 13:46:00 -0000 [thread overview]
Message-ID: <20150830134611.GA6579@embecosm.com> (raw)
In-Reply-To: <201508301233.t7UCX0Nv012040@glazunov.sibelius.xs4all.nl>
* Mark Kettenis <mark.kettenis@xs4all.nl> [2015-08-30 14:33:00 +0200]:
> > Date: Sun, 30 Aug 2015 11:09:45 +0100
> > From: Andrew Burgess <andrew.burgess@embecosm.com>
> >
> > There are a small (~26) number of places where the NULL pointer is
> > cast list this:
> >
> > char *wname = (char *) NULL;
> >
> > This compares to a huge number of places (~726) where we don't use a
> > cast, so:
> >
> > const char *name = NULL;
> >
> > I've never thought that the cast was either necessary or a
> > particularly good idea, it feels like unneeded clutter.
>
> The cast isn't necessary in assignments like that. However it is
> still necessary to cast NULL to an appropriate pointer when passing it
> as an argument to a varargs function.
Indeed. Specifically, these are the cases I'm looking at:
$ grep -re " = ([^)]\+\*\\s\?)\\s\?NULL" binutils-gdb/gdb/*
Thanks,
Andrew
next prev parent reply other threads:[~2015-08-30 13:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-30 10:09 Andrew Burgess
2015-08-30 12:33 ` Mark Kettenis
2015-08-30 13:46 ` Andrew Burgess [this message]
2015-08-30 16:06 ` Doug Evans
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=20150830134611.GA6579@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox