Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2017 21:44:03 -0700
From:      "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Ngie Cooper <ngie@freebsd.org>, 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:  <58A53702-FFF6-45E7-ACCD-9B776530064E@gmail.com>
In-Reply-To: <CANCZdfqgU8DJTdp4HkVxTU0PNpSGn45wJ0S1su=y2Td_uiVncA@mail.gmail.com>
References:  <201703160231.v2G2VgxK082641@repo.freebsd.org> <CANCZdfqgU8DJTdp4HkVxTU0PNpSGn45wJ0S1su=y2Td_uiVncA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_4FE0695C-43BB-4832-800C-D8D5F039D0B5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


> On Mar 15, 2017, at 21:32, Warner Losh <imp@bsdimp.com> wrote:
>=20
> 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
>>=20
>> Log:
>>  Return NULL instead of 0 on failure in _kvm_open, kvm_open{,2,files}
>>=20
>>  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.
>=20
> 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.
>=20
> So this change is an NOP for all compilers. It's a good STYLE change.

Someone made an argument a few weeks ago about NULL being definable as a =
non-zero value on some esoteric architectures or OSes.

I agree though, this is largely stylistic/pedantic for a good cause. If =
someone set NULL to something non-zero in value, they would be looking =
for pain :).

-Ngie

--Apple-Mail=_4FE0695C-43BB-4832-800C-D8D5F039D0B5
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJYyhgUAAoJEPWDqSZpMIYVu3IQAKcnuoyftDZrW4T3DVCcT36D
4vprKNb/fVJ0OH9PororOFmw9F/FEHxC4z5FF+sxMsaL9zgSrS30nO7zWpajtSid
zb3tcYVGrWm5W5eXPXx0fmpNMrOOPHSSgBrQFAb9t6XNfJC8RlKITNDhMpypX6WC
DOywWzW1G/LqtmMemPufw4UmQO7sjYS+gTUPzBkffGvhhjS+HNqIcpgyklBpP/li
rHM+HB1flh+mpW6PUO8tdHoI1GxPvKdTpOdDFV6N4nmx4MX1AIz4hlbonG6aAjiR
I6D1uzD7oEXGcvSmDriv5c4z3Dc92fZRLKnbDHOGy6P0Cqo5LozWFw2682vJX/vh
H2ByhDkZGUwU5IDFnGk1/gr80t+3E0iFmjUSeK4BSkQ6KNRn80WBovLPbdG5fnrJ
R44R3fYDbdYdb4FzgJu+qxsNZG7wmpDrpdFUhwBRqJLSywTW6QCySWpPvJd77YV3
KwFLDkkW+b6zaVwBML7KT5ZMIibFM89OB9mJbG/o3whUCOBqbUa0ZfRvY+oNvQIt
x9Qs1rv/0e5G5BFN46Am14r5bO9BFTXRzIqMYZOGOYqsA9noJacQa5tirTpncxxO
B1IyZsRgyJR50BbHBOVhmrZ5PyWGKrn+Yp9dqgJ7OyITTAcy7/xLXGpT1whwetDI
HTQ+AoYgHU86iqAlQGTY
=UfoL
-----END PGP SIGNATURE-----

--Apple-Mail=_4FE0695C-43BB-4832-800C-D8D5F039D0B5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?58A53702-FFF6-45E7-ACCD-9B776530064E>