From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id D7BC13858C74 for ; Sun, 29 Oct 2023 05:24:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7BC13858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D7BC13858C74 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.179.128.66 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698557057; cv=none; b=jxs7JzWwMNSM4U4xuAskKpjr5af7Cp9cKz+ud+Wl0bSqsOPnyX62e47zLIQFF8PH0DbZRIX2UNb7qRsKssnQexhd3wWz47W0ts6hN0Z4uy386rVdnHvA8Y1uF8BAYQ5C2bzIftL84rww/PBkC8A66sy1Ffw/J8BAm7egst60IzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698557057; c=relaxed/simple; bh=/7z7g7vOM1//vFpgXcwvnI3BvsmGLYk2zXB5GclNeQU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=mhKku/8eZOP+j353nZum/E1EOdrbZYvn9Vbplt35gAC0hPJ6YssGvbHo39dojdaACgwt2X7tm3iJ5v0NX5iIAz8m/PPaLOvAUQQ0OVpyq9TZS/3Q5E/nnsifQOwV59hnn1lMgGbeEHFKotVPC/wWjnNw+IHCVbftLdMGVtWEjzs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id A7F983C00F597; Sat, 28 Oct 2023 22:24:14 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id lGFi75WVDAAD; Sat, 28 Oct 2023 22:24:14 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 4BA1A3C00D226; Sat, 28 Oct 2023 22:24:14 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 4BA1A3C00D226 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1698557054; bh=AZF/SY63wzCRrQW03tITuwbivDtLJpP585YhQUrjA5Q=; h=Message-ID:Date:MIME-Version:To:From; b=I97225Bf/Ag34H8KS/OKrxzvUiMUuKqsoS6RglFRwq93zvaNY6pv3T7ILjZT8nMVB F9HTHRY2+d5xkaF3WMZR0/twFmLoioudZcPgbOqCzk5ga7qyRE1bImsT/6EAWcVVMH OeqMBogWgHX48umKOZguxjqAs4nSJSTGLCQl6Vz/cJV9fp5i49Vs08ZnEnnDPUuHlZ B1IMUkEZPaEEhoNwo8uE8AwtoY5WBgcAS8n6U9pYnWEbDRhtz8wYn67iSmnYYmt/ec WR57RMxXIitJTieD94rAvz/hyFwS1KfXUtcaxIjRLGkFCLPHfFWB1jYr0eWUgIU3Vl FFxETg8++BgRQ== X-Virus-Scanned: amavisd-new at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id q1zqhFY26Hbq; Sat, 28 Oct 2023 22:24:14 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 2A82D3C00F597; Sat, 28 Oct 2023 22:24:14 -0700 (PDT) Message-ID: <84e4081c-35ef-4f2d-89d0-0fea04732737@cs.ucla.edu> Date: Sat, 28 Oct 2023 22:24:14 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: glibc misc/sys/cdefs.h nonull - typo in comment Content-Language: en-US To: Jonny Grant Cc: Adhemerval Zanella Netto , GNU C Library , Xi Ruoyao References: <25d0b6fa-7b45-3f8e-946a-ad3256e211a4@jguk.org> <0d99df74-fb83-1647-ca19-17d2229f0ae0@linaro.org> <514c11a4-405b-f7f3-9a67-0b6c10ad7740@jguk.org> <21bc9125ab8ced26aa85f3f787f084c4af460a18.camel@xry111.site> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-10-28 16:50, Jonny Grant wrote: > Could you give an example of a POSIX API text you refer to that > specifies many arguments should not be NULL? "If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address space of the program, or a null pointer), the behavior is undefined." https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/V2_chap02.html#tag_15_01_01 This wording is copied from the C Standard. The April 2023 working draft of C23 has adjusted the wording to be the following, and I expect POSIX to follow suit eventually. Notice the new restrictions: "If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address space of the program, or a null pointer, or a pointer to non-modifiable storage when the corresponding parameter is not const-qualified) or a type (after default argument promotion) not expected by a function with a variable number of arguments, the behavior is undefined. "If a function argument is described as being an array, the pointer actually passed to the function shall have a value such that all address computations and accesses to objects (that would be valid if the pointer did point to the first element of such an array) are in fact valid.[210] "[210] This includes, for example, passing a valid pointer that points one-past-the-end of an array along with a size of 0, or using any valid pointer with a size of 0."