From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2552 Path: news.gmane.org!not-for-mail From: Rob Landley Newsgroups: gmane.linux.lib.musl.general Subject: Re: NULL Date: Fri, 11 Jan 2013 23:56:02 -0600 Message-ID: <1357970162.32505.3@driftwood> References: <50ED4E45.6050801@barfooze.de> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1357970190 11128 80.91.229.3 (12 Jan 2013 05:56:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 05:56:30 +0000 (UTC) Cc: musl@lists.openwall.com, Luca Barbato , basile@opensource.dyc.edu To: musl@lists.openwall.com Original-X-From: musl-return-2553-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jan 12 06:56:45 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Ttu5A-0002qC-Fm for gllmg-musl@plane.gmane.org; Sat, 12 Jan 2013 06:56:40 +0100 Original-Received: (qmail 4048 invoked by uid 550); 12 Jan 2013 05:56:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 4039 invoked from network); 12 Jan 2013 05:56:23 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:subject:to:cc:in-reply-to:x-mailer:message-id :mime-version:content-type:content-disposition :content-transfer-encoding:x-gm-message-state; bh=MZCxavCht03qw7bRhaFS7IR6ayajC9Lim4KTA1LEyAg=; b=g83xghtka0ykqSBm7cW8CxXPSSuKFPmpD0N8gkcavuAruWWgnZugXP/r6lrkRoa9Vw CWe7eP+jCkFxiM3Uahad7Z8s69n2olB36+aeCC5m4dhbn0KYF+Deg2uBoMfTCF1nKhv5 tdDYOmx+mYwdjiZY95tU3uepREwloNyBEkL5LB1Bg0f1Hf8nrZyHItNBIq9t0tTFRRKA 82ch1DCfIXb6y1cu25ejLcZczA3bhICIGKboFqKuVmpRWtsJhJhXLrSg3pDuIfY4mR+6 b6zSBxwFVmMBFFgqlJUT+P/nvE5q2jbaY5+r0Vv8MMC9sZMmkJUIgWA3Ce0D/ff8nGKu NN5A== X-Received: by 10.182.159.98 with SMTP id xb2mr18096053obb.35.1357970170790; Fri, 11 Jan 2013 21:56:10 -0800 (PST) In-Reply-To: <50ED4E45.6050801@barfooze.de> (from maillist-musl@barfooze.de on Wed Jan 9 05:02:29 2013) X-Mailer: Balsa 2.4.11 Content-Disposition: inline X-Gm-Message-State: ALoCoQntE7l2LtMScWBVtiy5Y8HXCNIY/1jlbelFcZ9jaoSp/6MWZdqczmPW7P48FBcOGgF/2D04 Xref: news.gmane.org gmane.linux.lib.musl.general:2552 Archived-At: On 01/09/2013 05:02:29 AM, John Spencer wrote: > glibc defines NULL as __null: a magic variable supplied by GCC and =20 > compatibles which always has pointer context. >=20 > musl defines NULL to 0 in C++. > this is correct per the standard, but breaks a lot of software on =20 > 64bit archs, > because it promotes to int. The C99 standard section 7.17 defines the NULL macro as: expands to an implementation-defined null pointer constant Which means it has pointer type. So either we can typecast it to void =20 *, or we can rely on the LP64 standard (Linux, FreeBSD, and macosX all =20 support) which says that long and pointer are always the same size on =20 both 32 bit and 64 bit, so trivial fix would be #define NULL to (0L) http://www.unix.org/whitepapers/64bit.html Rob=