This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Casting NULL pointer
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: andrew dot burgess at embecosm dot com
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 30 Aug 2015 14:33:00 +0200 (CEST)
- Subject: Re: [RFC] Casting NULL pointer
- Authentication-results: sourceware.org; auth=none
- References: <20150830100944 dot GA3916 at embecosm dot com>
> 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.