Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2017 22:32:54 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Ngie Cooper <ngie@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r315360 - head/lib/libkvm
Message-ID:  <CANCZdfqgU8DJTdp4HkVxTU0PNpSGn45wJ0S1su=y2Td_uiVncA@mail.gmail.com>
In-Reply-To: <201703160231.v2G2VgxK082641@repo.freebsd.org>
References:  <201703160231.v2G2VgxK082641@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 15, 2017 at 8:31 PM, Ngie Cooper <ngie@freebsd.org> wrote:
> Author: ngie
> Date: Thu Mar 16 02:31:42 2017
> New Revision: 315360
> URL: https://svnweb.freebsd.org/changeset/base/315360
>
> Log:
>   Return NULL instead of 0 on failure in _kvm_open, kvm_open{,2,files}
>
>   This is being done for the following reasons:
>   - kvm_open(3), etc says they will return NULL.
>   - NULL by definition is (void*)0 per POSIX, but can be redefined,
>     depending on the compiler, etc.

No, it can't. The C language requires all integral expressions that
evaluate to zero to convert to the NULL pointer. This is independent
of the internal representation of the NULL pointer.

So this change is an NOP for all compilers. It's a good STYLE change.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqgU8DJTdp4HkVxTU0PNpSGn45wJ0S1su=y2Td_uiVncA>