From owner-svn-src-head@freebsd.org Thu Aug 9 21:41:37 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 8AD0910744C5; Thu, 9 Aug 2018 21:41:37 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (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 1C2E6896BF; Thu, 9 Aug 2018 21:41:37 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x233.google.com with SMTP id y207-v6so12367320oie.13; Thu, 09 Aug 2018 14:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=i4shtrkOdcE9KwB4QryY5diQ3TQHV9xR36gFhUBkV+E=; b=iQNYn3rU3CpT+1ghDgOZHBphpUAlF7SGr4XzhXdy30RZ4iIhgLsgYujrEG75uxW84Z x7M+jc/BudHW3kzm0MtifebaSjNjQS9/exDaQkWYghLAXTv7pkXI874fP/CxITH7mBZ5 jFmZsAMmb+2HyuBYoH3alrCSBSWIfMkAkltbZsa60zti3xfxSguvZdAXnlRSLpwfBTT2 rdRU4ophmvwYpwCXpskO9VmNPt/q9Kzae03SDUuzTnj6/GLI7/PfyON47+d1VPDYnlhI 2ejMcUuI/dO3Q/kzX7CvahmUKghCN26YiM7UY/whtGnlxtAi/oER8eSLke4a5Hj67hIJ +47w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=i4shtrkOdcE9KwB4QryY5diQ3TQHV9xR36gFhUBkV+E=; b=uESMXVDbtfxOcffQFBAEUGIKqv7lgj8mHOYuXxWHcLlip0DVwscVunA3AC40fkjeAW nvXV6tJ2lPBWFWmCHQ7vCcy4G7KduF7IN2KwzvNdcYtCFV3zHqD+MP2OqUvLrccmcKUF tdJ0AplBSGzkrCIkYYWBREVPshmUPZHdbcKG+vRdjxC5wJBwW3YgYB4M+EBwL/8YNu6Z tKIQa9u6P7Iufwlq4CxBKRE04gq3049c82zbV+lmU3EQcaxEq1So0enpzg6zLGiyhkXE 3HesgYXSfbz1cwco2WIvliW4Ckl3i7E49R+mQ2GXqpnEM+hIwfcXvvi+5hCm4LwSutdi g87w== X-Gm-Message-State: AOUpUlH79GWC6LdidKQP//f9/2SIwIuNb/aXRgxqE69LH9gnMa1EkPy5 Uc+0nxfHf0iWhiVmZZv38xjV5VX3xmjAqlJ+9DB5U5m1AWs= X-Google-Smtp-Source: AA+uWPwdURi5wRs+HB82yU6vupY6hbnVoWVtZRN1JD6qR24KX9sLf2a3iv718HFvfbHBqjCiZkoc480Aw2ZBpSmFxGk= X-Received: by 2002:aca:e754:: with SMTP id e81-v6mr3747251oih.203.1533850896384; Thu, 09 Aug 2018 14:41:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:3bb6:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 14:41:35 -0700 (PDT) In-Reply-To: References: <201808091217.w79CH3gO096411@repo.freebsd.org> From: Benjamin Kaduk Date: Thu, 9 Aug 2018 16:41:35 -0500 Message-ID: Subject: Re: svn commit: r337535 - head/sbin/init To: "cem@FreeBSD.org" 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-Content-Filtered-By: Mailman/MimeDel 2.1.27 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 21:41:37 -0000 On Thu, Aug 9, 2018 at 11:03 AM, Conrad Meyer wrote: > On Thu, Aug 9, 2018 at 5:52 AM, Benjamin Kaduk wrote: > > On Thu, Aug 9, 2018 at 7:17 AM, Edward Tomasz Napierala < > trasz@freebsd.org> > > wrote: > >> Use NULLs instead of casted zeroes, for consistency. > > > > It's probably helpful to note explicitly that these are not in argument= s > to > > varargs functions, > > I don't think it's helpful. > > > in which case the explicit cast is needed in order to produce a program > that > > 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 stron= g 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 *, > is > > 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. > I don't really feel a need to continue the discussion that was already started in response to r336835 (in addition to the current thread), so I'll limit myself to asking whether we want to be writing standard C or a FreeBSD-specific dialect of C. My understanding was that we had some experience with the latter (e.g., heavy patching of the compiler) and it ended up with us in a bad place, which would tend to support writing standard C or as close to it as we can. (Yes, I know that we have non-standard printf specifiers and the like.) -Ben