From nobody Fri Sep 13 11:59:14 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X4tBs5gKpz5Wqfj for ; Fri, 13 Sep 2024 11:59:17 +0000 (UTC) (envelope-from paulf2718@gmail.com) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X4tBs0YHvz47sf for ; Fri, 13 Sep 2024 11:59:17 +0000 (UTC) (envelope-from paulf2718@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=aXKpMfmD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of paulf2718@gmail.com designates 2a00:1450:4864:20::434 as permitted sender) smtp.mailfrom=paulf2718@gmail.com Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-374c3eef39eso1316375f8f.0 for ; Fri, 13 Sep 2024 04:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726228755; x=1726833555; darn=freebsd.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=TfW5O+YhZ8UlSFzbZcU1We4M28KSkqU+jaqE0Hs3HiI=; b=aXKpMfmDx6uviRTEbpWR7ycerKuPdh3kg+JP6uI8X4bFKFTBAN7e0i21YdSRjCMXHN 10Y/for0tPNciSCugSV9ybyzZSdaACy1GoHCkv39cdZJDd8TX7wT2a0Cfcj7EjzbgYdO QK9Txc7rCQtNBL21M5avudxR6sysH+jB6pZEYfMdmd52B/4m/R8z8sUoqrTuWYN0w5/c s6kBIdqQRzuG7J47fAKMBvUCAcpTk+tmaQCcG2DEBnUC+XHOTjV3lo0dKQ6jC4+F5Otf LuBzmd6tDh1xlo30+pETGh3L6NiD+YEx7QUcZQ+b+ppnSAKg8+uN455IXaRpMfDV3JpB Q0qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726228755; x=1726833555; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TfW5O+YhZ8UlSFzbZcU1We4M28KSkqU+jaqE0Hs3HiI=; b=k2RLrSGgj7m0UeziAOF4RchlMDS0gRR/7Ds3CVGDcU6ASpcZOqPgaLfNHsdTbwbiq2 dsYbFc13GMl2eF/j1bGVs/0UfHWkXw23xvvb7Cu8A1LwYChsd33+eD3+sOoJzbtXVtgx I0tFHcagMavrtv3isxxy+gY+tSouRUJTbcTpgjSas5edgeIR+YqYG9eXWIKGc//xbdeD 2PkHw2zN4AAG1AU8bU78JqhbjEwEiXahBYoK8/WxI6ECAF6ZU9lQ/qwXr2WIPX5NXKBZ TSQG6XpUaYjRuh52BD1lvdRW9/VJtgoMgsS98cM/ZYams4TubsVo8Aw0LOqC5tSuRVuh cwxg== X-Gm-Message-State: AOJu0YzlayrCU9vXVIuNT1hP6V1IjQQo5EAen6XcP28OvasMd4X7Y5/w h31rn5ahqQksOUNIGUvtOq3VNyFQ9Tpx845Yb7b4Jkn3bOBrXfmSlx9jbQ== X-Google-Smtp-Source: AGHT+IGPRemxh0yZi7yiJBuY3F7k+j1Ifm1Z1TEUNHViAvt0SF81JCyYG5d7DN9rzz8MCfobL9wt6g== X-Received: by 2002:a5d:4984:0:b0:371:9154:597 with SMTP id ffacd0b85a97d-378c2955aeamr3663816f8f.0.1726228755121; Fri, 13 Sep 2024 04:59:15 -0700 (PDT) Received: from ?IPV6:2a01:cb15:801f:7500:1aa9:5ff:fe16:2efb? ([2a01:cb15:801f:7500:1aa9:5ff:fe16:2efb]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956654f4sm16709594f8f.43.2024.09.13.04.59.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Sep 2024 04:59:14 -0700 (PDT) Message-ID: <9924d197-1b3f-4781-9fe0-20579c8e9066@gmail.com> Date: Fri, 13 Sep 2024 11:59:14 +0000 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: The Case for Rust (in any system) To: freebsd-hackers@freebsd.org References: <2EE309BF-CE1D-48AD-9C53-D4C87998B4A0@freebsd.org> <2D0F93DC-36DA-4FB9-BFD2-D7678EC03CD7@FreeBSD.org> Content-Language: en-US From: Paul Floyd In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::434:from] X-Rspamd-Queue-Id: 4X4tBs0YHvz47sf On 13-09-24 11:40, Aryeh Friedman wrote: > > 1. Fixed allocations are *ALWAYS* safer and more predictable then > dynamic ones (dynamic ones are undecidable in there nature and > effects). > > 2. Combining fixed allocation with dynamic (under the hood and > unrequested) allocation is a very bad idea. > > 3. It is possible to do all the above safely with arrays and not > pointers IF the arrays are static but not dynamic. > > This implies that if and when you grow/shrink the physical array you > need to have really tight control on timing and Rust does not provide > that by putting it all under the hood. You aren't being very clear with your vocabulary. In C there are 4 main kinds of storage. Global, static and automatic. These are all of constant fixed size (except for automatic which can use VLAs since C99 which is of variable fixed size). Dynamic, as managed by malloc and family. Can be constant sized or variable sized. Which of these is your array that can grow or shrink? A+ Paul