From owner-svn-src-head@freebsd.org Thu Aug 9 16:03:11 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 DE29B106B367; Thu, 9 Aug 2018 16:03:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B7827B6C1; Thu, 9 Aug 2018 16:03:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f50.google.com with SMTP id e14-v6so961392itf.1; Thu, 09 Aug 2018 09:03:10 -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=hWWdtXzGX0dUWaMW8dG+2iXtboIqDLlGgPP1YE+y9aU=; b=LiVQwGhnVxyf20FiVpo/Ze3ZZqHMzkti0Lsh7HxEpL+otpfXXb20XbdIj1VTFTNke6 MocJOtsZahTHqDiNJtQTJH5VDEVoi9xIGB8GFiH9BdPimtdX70pgaIovahlBcUHOHpuz jy5BmVB4eb8tMYsl5oGfK7592BFUP5x3aPPX1dy284t4VT0y2FUYvVmbdJySyhrcN57d t1qv6tIRVKqgN51N7zXC3JHr5ZjovERB4vLJkwcxsKpF9uzV3htuQRNcRH3RAYCDP+Q8 j3F9VrvCXn5RRv/S2LY+2G2bMXH1UOTN7KCWGN1Apn/sBDxPorR9wP4GaQq40u7Tm4Ib hGdw== X-Gm-Message-State: AOUpUlHHggUcB/D+LhxxpYf+qCJilZf/E7TYuvBeki+fsuUK+JYSMyXO CF32pdgFAKTTwPo0TwNwhj+voyFM X-Google-Smtp-Source: AA+uWPwhzDTVkCvXAjxLO0peIFlntWHqBTbfmZBGGs3MoO1hlbfRdkO1lZG1J7wyth8ryApVuD7JQg== X-Received: by 2002:a02:bb04:: with SMTP id y4-v6mr2467003jan.5.1533830583395; Thu, 09 Aug 2018 09:03:03 -0700 (PDT) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com. [209.85.214.45]) by smtp.gmail.com with ESMTPSA id w20-v6sm2102313iob.24.2018.08.09.09.03.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 09:03:03 -0700 (PDT) Received: by mail-it0-f45.google.com with SMTP id s7-v6so930782itb.4; Thu, 09 Aug 2018 09:03:03 -0700 (PDT) X-Received: by 2002:a24:be8f:: with SMTP id i137-v6mr2518969itf.61.1533830582911; Thu, 09 Aug 2018 09:03:02 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:7e0a:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 09:03:02 -0700 (PDT) In-Reply-To: References: <201808091217.w79CH3gO096411@repo.freebsd.org> From: Conrad Meyer Date: Thu, 9 Aug 2018 09:03:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r337535 - head/sbin/init To: Benjamin Kaduk 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: Thu, 09 Aug 2018 16:03:11 -0000 On Thu, Aug 9, 2018 at 5:52 AM, Benjamin Kaduk wrote: > On Thu, Aug 9, 2018 at 7:17 AM, Edward Tomasz Napierala > wrote: >> Use NULLs instead of casted zeroes, for consistency. > > It's probably helpful to note explicitly that these are not in arguments = to > varargs functions, I don't think it's helpful. > in which case the explicit cast is needed in order to produce a program t= hat > will have > correct behavior on all compliant compilers/systems. Here "compliant" means "minimally compliant to the C standard." Use of NULL in varargs is functionally correct on all FreeBSD systems. > (We do define NULL to > be a zero-with-cast, > but programs (Ones that care about portability to weird systems.) I don't think BSD's 500 line init =E2=80=94 hyper local to FreeBSD =E2=80=94 is a strong = candidate for portability. > should not assume that NULL will be of pointer type -- "An > integer constant > expression with the value 0, or such an expression cast to type void *, i= s > called a null pointer constant".) Right. The problem only arises when both conditions are met: 1. The system's varargs representation is smaller than the pointer representation, and 2. The runtime headers do not defined NULL as a pointer-typed value. (3. The function being invoked is actually varargs?) Neither is true on FreeBSD and v7-style init is not a useful place to call for portability. All the best, Conrad