From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 24141 invoked from network); 25 Nov 2023 18:49:54 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 25 Nov 2023 18:49:54 -0000 Received: from wopr.sciops.net ([216.126.196.60]) by 9front; Sat Nov 25 13:48:17 -0500 2023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sciops.net; s=20210706; t=1700938019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Xk124w69mYlGnngQOxajGfiflxAzx4J/ktyyrgpezyQ=; b=uAoMpOrcrUgchNXGi+tBoPbteRVWGuMMmpEaewsm22kKYklE8WNaBesNQnVCQHqlJXNjOf VzkDwX1PB8YvV5n1YV8ghlgxHziMdQLLeug0Yvi9/pwvQrHo+5Gkz+TKCege8Vz6xR21bQ YgLQpkQo7groAqiDIuEphe9sW9Bt6/I= Received: from localhost (wopr.sciops.net [local]) by wopr.sciops.net (OpenSMTPD) with ESMTPA id 83e91f5f for <9front@9front.org>; Sat, 25 Nov 2023 10:46:59 -0800 (PST) Date: Sat, 25 Nov 2023 10:46:59 -0800 From: Kurt H Maier To: 9front@9front.org Message-ID: Mail-Followup-To: 9front@9front.org References: <2BE1963ED309D739C71303706B8B520C@eigenstate.org> <9636bf23-5c91-41bd-b9c4-98685cabf9c0@invalid.invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9636bf23-5c91-41bd-b9c4-98685cabf9c0@invalid.invalid> List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: cache replication hypervisor-aware control Subject: Re: [9front] [PATCH] Fix assert macro to not break on commas Reply-To: 9front@9front.org Precedence: bulk On Sat, Nov 25, 2023 at 07:09:40AM -0500, Blue-Maned_Hawk wrote: > On 11/24/23 23:34, ori@eigenstate.org wrote: > > Assert should largely behave like a function; the only reason > > it's a macro is for slightly better debug prints. > > > > We don't try to make functions take comma expressions in the > > argument lists either. > > > > sin(1,2); // also errors; > > > > If you really need a comma expression, you can parenthesize it, > > just like you would for a function call. > > > > assert((expr,list)) > > > > > > Ah, but see you now: there are situations which break for a macro > invocation, but not for a function call, such as the usage of a struct > literal, because the preprocessor doesn't tokenize in the same way as the > language itself. Consider the following obviously-contrived situation: > > assert((struct Tm){.nsec = 0, .sec = 1}.sec); Making the language dumber because someone wants to do something stupid is the wrong plan. khm