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=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 7C0402B87C for ; Thu, 22 Feb 2024 09:35:26 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1708590926; b=jjdKPEol+KJcxN1dScDUO0Uiw5lP79X5QyoT9nuk+BCC5z/0bRNb30WSt6YuplSurQgM9PIwVR 36tdbWzDbrfiJlB0bvCH2W1NY8XB0TaoX3AFXhuWdG0Z47FThcBV/8SfL4AuUnIqWwhnsztkSF pk68P+pLDH8JnLs1QgIcRATMDBJlszgDZZNsU0La/XEPuoNthCVH6pGccB9hNeNpmA6Glhx180 CChVsMgfOvYt9cbU6FCZcaOrIXjLJgoCqBmDSuWCxFBYpy1h+hWL/Zr+TxSOEhoEVAnh799Vfl L3PGyZCM/TnWZlGBK/DskAJ+XQkEomSx40irG/IGKLqYpg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f175.google.com) smtp.remote-ip=209.85.208.175; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1708590926; bh=amSHPpjQ16lOWculE2g9lZzBmKoI71i62tCiv+Py+Ok=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=hHd/leCQ+bC+GKz26QYOkiySg12VQ87VEBTvIQf+dHprW9PbNxaxOQ7XNF9MOTmw4wHbP8tFKa gF/UJtqwAh58uo4d+QwzjjpOPGR+y+r5XrcfN2JNvYHEIOoZj6CAbdAbQKrMQTpWWGjkoMae1U wEfuHFLukDpzJqOCsJGXlK7q8RN1VU7f879jCRXnnnHnp5asVf1eU3+S8Jc3WtdtQRs8PdLNIP Mb7ra5o/6rzD+519cUxYjZC9nZYUM+JZBt0rZV9k3hoqc3i6JwBB+YEQHSA8T2o/PDGpIvvvHR 5a2OL+PziYwKD/f1XzKnCQg2gwLx+3P9n/0IJPlHrT+wBg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=4kd7L78OUoeMP3gk6+bOmvzP4wHh94El8a9KBPl6otw=; b=PIYkIoZQfVcf60Kio9NSo+/P48 UvhPkZ2bVNFMD7tHjaoRR0ULz+PtlajDTnCh2uWSnVbibiV/bPkXYLNXUWFNEoOs3YzKZ3Tey9i5I 1XuEXVaJ8b+GNZ31NRgYND6qM63qCeJvnStpxBTQLiKvuQ74jpscQgMzeEGIaisidpNVS2BTJWLKt gFIJBcD2w7IaeVfvEFwox5RTyM8Bq+iI2ESEeaN8QnqyoHx2PPOzd68dOv5BCjz/6WIKoKw7iAi9g feeMuWLXFb3PYEqTOpK1DMnw+YJlC/uLRjtZnt20f9UdndL5CQ3j/JtxFz1YPcJvtoUzdJ9mufDPN XjoaYuQQ==; Received: by zero.zsh.org with local id 1rd4Y9-000JrV-P3; Thu, 22 Feb 2024 08:35:25 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f175.google.com) smtp.remote-ip=209.85.208.175; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f175.google.com ([209.85.208.175]:46439) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rd4Xt-000JaK-R1; Thu, 22 Feb 2024 08:35:11 +0000 Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d2533089f6so20833461fa.1 for ; Thu, 22 Feb 2024 00:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708590909; x=1709195709; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4kd7L78OUoeMP3gk6+bOmvzP4wHh94El8a9KBPl6otw=; b=ZZCG3j+QubPfHSCNHRqPYmhk2OMPjXRdhTeMnGsuEaRLhJt1sc/M8EkzS5GA49rDoD DjbUgVRfcCpWAyNXW5RIEfLMlxeX9rt8v4M6qCHOYLiymlu4XPM2nu+wQH7khtpbPprL aOMRm6AvwlNXAZdbiIPriSzJ1G8eS8C9Lwn3GQ6AP6LOpfXSxRXfXxYbxwiI0rIVcQN2 5RS+oTbqWtPUm542yCuve4WSf9Lg7TeIsZPrj6a17QNDhIfhJhE0emu3HBTIs5WWEq1g zeWiK/n+uqpdlDVHIH+8To15TOgMgrS4gwXU3Q5S8g2Oy6UPGQS2PbQYfpGqdUVE+eON VDGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708590909; x=1709195709; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4kd7L78OUoeMP3gk6+bOmvzP4wHh94El8a9KBPl6otw=; b=MJYYJ17dpdmo5yk5gXb7DI/fNd545UQk+U/WuqaU55/pQk88FQZQluF9wBUxAw9y7c lgIssa+hm2NcANLPLMTmKIZ9ebpBSaxOKBLiJT5I7hBGbIY2PlLs7Z3kljMY3xCL0xGK Umg8kZIyYUXBAyrEVNyAUsIeLhNC8t8Pcrctdie61GRqR2dgRpJNHsmbEhybrx7YPgrE diQVtMxxxDY/ULVF2w4zBQKLC2cZINgGH3i4vhEj4WZjHxa7km3+pFK89bZH7ISGNrig e9E6DhqmkxN9f2u6mz6ZPglTlmfNTtgFIYF211hxZzxvxnz58u3cBPrbhQlHHTvEPA3I TvPQ== X-Forwarded-Encrypted: i=1; AJvYcCXGnmPMmw99ouK46oEZCaOy2P4hHX2feGWuEABPj+zRy1Shpzp/tE/ap9JL7hjSgQItlkYYLvlHmvR0s1r6Vm+ZlP9O X-Gm-Message-State: AOJu0YwfXpLlOGsuaD4QQUkdNzXPmDqD0v+MsIZofelUD55o7cTNXnzk 2jSOeoFzJcmTn3XvR9x/P30jrlm82G9DJIEtGltnAGU3gEJQ01eOGACqruyc1Tdwlzwq99GV4Jh KB4CiQYr+UvafBvJ3Mpa1ZAHVJOLJYcbsruo= X-Google-Smtp-Source: AGHT+IEn38KIeiISSiBht7S1EcGubqpHT3idh3o5UUNuhhN/n99QviorIVQZbM4tcvqQEdbhzBBpK1zeSzHDAcSPqLs= X-Received: by 2002:a2e:a545:0:b0:2d2:3e75:32e8 with SMTP id e5-20020a2ea545000000b002d23e7532e8mr7073897ljn.13.1708590908471; Thu, 22 Feb 2024 00:35:08 -0800 (PST) MIME-Version: 1.0 References: <20230113080246.nghigc4givvaomve@chazelas.org> <836025199.2014747.1673889335246@mail.virginmedia.com> <20240220070505.fd6jfbcdldieqv7u@chazelas.org> <20240220193911.avnmcqfliwltkj5m@chazelas.org> <20240221194534.o2mufin7orng6ttg@chazelas.org> <20240221202150.tccftcqbxqqexq4x@chazelas.org> <20240222072313.7woy5vxvt4fbxyhj@chazelas.org> In-Reply-To: <20240222072313.7woy5vxvt4fbxyhj@chazelas.org> From: Roman Perepelitsa Date: Thu, 22 Feb 2024 09:34:57 +0100 Message-ID: Subject: Re: [PATCH] unmetafy Re: $var not expanded in ${x?$var} To: Bart Schaefer , zsh workers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52577 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Thu, Feb 22, 2024 at 8:23=E2=80=AFAM Stephane Chazelas wrote: > > > + fwrite(unmetafy(dupstring(str), &num), num, 1, file); > > Being no C expert, I wonder if it's safe (portable) to set and > use num in the same call like that. Is it guaranteed to be done > in the right order? In C, function arguments are evaluated in unspecified order. The behavior of the fwrite() call above depends on the evaluation order of its arguments, and is therefore unspecified. Evaluation can even be interleaved. Consider: a(b(), c(d())) Here, it is possible that functions will be invoked in this order: d, b, c. Basically, function arguments are evaluated before the function is invoked (obviously), but other than that there are no evaluation order guarantees. Here's another example of unspecified behavior: *f() =3D g(); Here, f() and g() can be evaluated in any order. There is a related gotcha where the same object is accessed more than once between sequence points and at least one of these accesses is a write. Like this: int a =3D 0; int b =3D ++a + a; Or like this: foo(++a, a); This is undefined behavior, not just unspecified. Roman.