Deutsch   English   Français   Italiano  
<20250409132618.11@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Wed, 9 Apr 2025 20:38:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <20250409132618.11@kylheku.com>
References: <87y0wjaysg.fsf@gmail.com> <vsj1m8$1f8h2$1@dont-email.me>
 <vsj2l9$1j0as$1@dont-email.me> <vsjef3$1u4nk$1@dont-email.me>
 <vsjg6t$20pdb$1@dont-email.me> <vsjgjn$1v1n4$1@dont-email.me>
 <vsjk4k$24q5m$1@dont-email.me> <vsjlcp$230a5$1@dont-email.me>
 <vsjmdl$277bk$1@dont-email.me> <VsdHP.1828827$TBhc.1078002@fx16.iad>
 <vskjlo$34st8$1@dont-email.me> <20250402220614.431@kylheku.com>
 <85mscxlqnb.fsf@nosuchdomain.example.com> <vsl9sn$3vdjj$2@dont-email.me>
 <20250403121946.134@kylheku.com> <vsms75$1i8ud$1@dont-email.me>
 <vsnhq6$291i3$4@dont-email.me> <20250409124900.00000fa1@yahoo.com>
Injection-Date: Wed, 09 Apr 2025 22:38:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b6338aaa8cf77c0ab038d735b08c2473";
	logging-data="1477112"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+DTXTZuYVftHJd/BGx7EH7hYvC0PN0XnE="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:CEn9MnL7yrb3dd5Qcdy9ibOgN3Y=
Bytes: 3139

On 2025-04-09, Michael S <already5chosen@yahoo.com> wrote:
> void foo(void) {
>   bar(1,);
> }
>
> MSVC:
> comma.c(3): error C2059: syntax error: ')'

In a language without preprocessing, it might be acceptable.

If bar happens to be #define bar(x, y) then you
are passing an empty argument for y.

Or, suppose you have bar(ABC, DEF), where ABC and
DEF are macros.

DEF happens to expand to nothing, so we get bar(whatever,),
and since bar takes one argument, it works silently.

(Consider C++ where we can have bar(arg) and bar(arg, arg)
overloads.)

Just little bits of chaos that point to "bad idea".

> But is it (rejection) really required by the Standard? I don't know.

Yes?

  6.5.3 Postfix operators

  6.5.3.1 General

  Syntax

  postfix-expression:
    primary-expression
    postfix-expression [ expression ]
    postfix-expression ( argument-expression-list_opt )
    postfix-expression . identifier
    postfix-expression -> identifier
    postfix-expression ++
    postfix-expression --
    compound-literal

  argument-expression-list:
    assignment-expression
    argument-expression-list , assignment-expression
              
                            ^^ ^^^^^^^^^^^^^^^^^^^^^

You see that last bit? The grammar for argument expression lists
is essentially an expression grammar in which the comma is the
one and only left-associative infix operator.

After the comma, the assignment-expression operand is not
optional, the same way that in an infix expression E1 + E2,
the E2 is not optional.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca