From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from minnie.tuhs.org (minnie.tuhs.org [50.116.15.146]) by inbox.vuxu.org (Postfix) with ESMTP id D4D622CB93 for ; Sun, 29 Sep 2024 17:17:23 +0200 (CEST) Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 71D5B427C4; Mon, 30 Sep 2024 01:17:17 +1000 (AEST) Received: from arjuna.pair.com (arjuna.pair.com [209.68.5.131]) by minnie.tuhs.org (Postfix) with ESMTPS id 51CA7429AD for ; Mon, 30 Sep 2024 01:17:13 +1000 (AEST) Received: from arjuna.pair.com (localhost [127.0.0.1]) by arjuna.pair.com (Postfix) with ESMTP id 987618A701; Sun, 29 Sep 2024 11:17:12 -0400 (EDT) Received: from orac.inputplus.co.uk (87.70.200.146.dyn.plus.net [146.200.70.87]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by arjuna.pair.com (Postfix) with ESMTPSA id 652FA8A6B0; Sun, 29 Sep 2024 11:17:12 -0400 (EDT) Received: from orac.inputplus.co.uk (orac.inputplus.co.uk [IPv6:::1]) by orac.inputplus.co.uk (Postfix) with ESMTP id 2BF7322018; Sun, 29 Sep 2024 16:17:11 +0100 (BST) From: Ralph Corderoy To: TUHS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-reply-to: References: <20240928165812.4uyturluj4dsuwef@illithid> <9049DF63-F7BE-494F-BF7C-6BD0565C0D06@iitbombay.org> <20240929100611.272292033C@orac.inputplus.co.uk> Date: Sun, 29 Sep 2024 16:17:11 +0100 Message-Id: <20240929151711.2BF7322018@orac.inputplus.co.uk> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inputplus.co.uk; h=from:to:cc:subject:mime-version:content-type:content-transfer-encoding:in-reply-to:references:date:message-id; s=pair-202402161033; bh=PfqYBLGC0TgmZeVuP2Jzq3+cCxw1U/LJplVgCFhiiak=; b=bq9tHT0vl1+cYPvhwRaYifG7j4EGkAMkluYq8/+VFO9d++ceGTakiwfjVqAhDDsvxZKyhCyZk0MohLTqiKJsoBJ/7d5AZOuSFJBdKl4NZpyYM+SCiOY87+GbIFAAoEDJcWbTBKQM4FpZ1lzPUFdhlRLx83CwrNNIMbbGWR57aEfrffPv7DAaRN3ArbfuIXtcwsVoYp9QNlSYOXTE6QNsbNHFGof0TXKC0kMaPeDxCKeVI+4+Uwu/sc1i6tbyw4v7Vx5ifP2gAsBmLY3vkMmjL9WW1vLmmX9iCdo41VB6vqlxO72Xega4V1i/IiHRK8V04JYDXiduvbILIpR76KWaWQ== X-Scanned-By: mailmunge 3.11 on 209.68.5.131 Message-ID-Hash: AQHOTPEQLT22X6Q73XGRZMYGN6H4ZTDV X-Message-ID-Hash: AQHOTPEQLT22X6Q73XGRZMYGN6H4ZTDV X-MailFrom: ralph@inputplus.co.uk X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Douglas McIlroy X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: Minimum Array Sizes in 16 bit C (was Maximum) List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Werner, > > malloc(0) isn't undefined behaviour but implementation defined. > > In modern C there is no difference between those two concepts. Can you explain more about your view or give a link if it's an accepted opinion. I'm used to an implementation stating its choices from those given by a C standard, e.g. (42) Whether the calloc, malloc, realloc, and aligned_alloc functions return a null pointer or a pointer to an allocated object when the size requested is zero (7.24.3). I'd call malloc(0) and know it's not undefined behaviour but one of those choices. -- Cheers, Ralph.