From owner-svn-src-head@freebsd.org Sat Jul 28 20:22:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF34B105D0DC; Sat, 28 Jul 2018 20:22:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A6927F0E3; Sat, 28 Jul 2018 20:22:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f176.google.com with SMTP id g11-v6so6857756ioq.9; Sat, 28 Jul 2018 13:22:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=OVPht73znUK8jqTXvmsM2MdJpoB5+jraf/Qq9sKXTDc=; b=ChDsovZRhI4v6ScrsS+BuYcMKWdN8Ig8pWRJMBuOuFKvo3GuPEGitz9dKaVmiED5WM PRTxcag583j5nx0yZYRbyRw2vXVP8rDPVJ5VTzJALDxkNGvacs8h6qZFCQVtEwNGmD5R uuDmAzQOCC5F5r+cRx47obGgcwILmuAnlYM1WoU6KfylyOhMF77YRdXrpBxKf6xJx9vD sftqK2w4YLdgPXbCQ2NUrhZVrW8FegOwA+KLu+4kRDfbp40bBW+KFUL8pgWmUvHjdCYA enPbD9YE/SBS5X8Pq4Xq8fZWtu7Kim7sudg/Os4nTUqBGNkheEEa7+OoibPl5lapOrJF WtZA== X-Gm-Message-State: AOUpUlH/22x90Zbaq/hKkRnPq53nl58CC20U8IfsMHC4XVteVofVY8Kb Sp2E3zQXUSfhhG7KeL5pWWP5hU+k X-Google-Smtp-Source: AAOMgpeQE/DwEDC0z9PI8TGWevmUnw8IyYGgh1UmgVpJlxECzQeUae3ipIYpKYRX4OSFe2wtsxelhw== X-Received: by 2002:a6b:d611:: with SMTP id w17-v6mr9406247ioa.216.1532809006588; Sat, 28 Jul 2018 13:16:46 -0700 (PDT) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id 137-v6sm6747476itl.39.2018.07.28.13.16.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Jul 2018 13:16:46 -0700 (PDT) Received: by mail-io0-f174.google.com with SMTP id q19-v6so6843591ioh.11; Sat, 28 Jul 2018 13:16:46 -0700 (PDT) X-Received: by 2002:a6b:b0c5:: with SMTP id z188-v6mr8978436ioe.220.1532809006354; Sat, 28 Jul 2018 13:16:46 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:7e0a:0:0:0:0:0 with HTTP; Sat, 28 Jul 2018 13:16:45 -0700 (PDT) In-Reply-To: <20180728200611.GA40119@kib.kiev.ua> References: <201807281908.w6SJ80qo089859@repo.freebsd.org> <20180728200611.GA40119@kib.kiev.ua> From: Conrad Meyer Date: Sat, 28 Jul 2018 13:16:45 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r336835 - head/lib/libc/gen To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jul 2018 20:22:12 -0000 On Sat, Jul 28, 2018 at 1:06 PM, Konstantin Belousov wrote: > On Sat, Jul 28, 2018 at 07:08:00PM +0000, Conrad Meyer wrote: >> For unclear reasons, POSIX' definition of these routines spells NULL a= s >> "(char *)0." This is needlessly unclear. One guess might be that POS= IX >> targets more exotic computer architectures than FreeBSD does. Fortuna= tely, >> there is no such problem on any reasonable platform for FreeBSD to sup= port. >> Spell NULL as NULL. > > The reasons are quite clear. Unclear here refers to the lack of documentation, not the absense of a possible explanation. > Practically NULL has to be defined as '0' > or '0L' at best, for C and esp. C++ rules of the pointers automatic > casts to work. This means that NULL cannot be used in vararg lists where > the pointer is expected. This is not true on FreeBSD. NULL is (void*)0 in all C code, and the special nullptr value in C++. Yes, this is a stronger definition than the C standard guarantees. This is because the C standard permits much more exotic architectures than FreeBSD actually runs on. > In other words, the (char *)0 part of the pre-commit text was correct, > while after-commit use of NULL only works on machines where pointers > have the same representation as ints or longs. I believe this encompasses all architectures FreeBSD supports =E2=80=94 eve= n ignoring our sys/_null.h definition of NULL as (void *)0 or nullptr. Best, Conrad