Groups | Search | Server Info | Login | Register


Groups > comp.std.c > #6618

Re: int n = {{0}};

Path csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.std.c
Subject Re: int n = {{0}};
Date Sun, 03 Dec 2023 14:00:39 -0800
Organization None to speak of
Lines 35
Message-ID <878r6b3q0o.fsf@nosuchdomain.example.com> (permalink)
References <8734xwkc1c.fsf@nosuchdomain.example.com> <86cyvnw0n4.fsf@linuxsc.com>
MIME-Version 1.0
Content-Type text/plain
Injection-Info dont-email.me; posting-host="f2a47b77cfc24e924416c84c84ca6a31"; logging-data="3205152"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198Hiy7ke6NtZa6ljS4NLEW"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:mpmyWuu+zYuJ4o6hxy91TlceteQ= sha1:3NiNoGaOozDybNroM3rjcaqT7LM=
Xref csiph.com comp.std.c:6618

Show key headers only | View raw


Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Citations are from N1570 (C11 draft).  I don't think there are any
>> relevant differences in other editions or drafts of the standard.
>>
>> Quick summary:  Why is
>>     int n = {{0}};
>> undefined behavior rather than a constraint violation?
>
> Because there is no practical benefit to changing what the
> standard says now.

Do you have an opinion about whether it should have been specified as a
constraint violation rather than undefined behavior in the first place?

[...]

> There's no practical benefit to changing it.  The current rule
> has been in place since the original ANSI C standard, more than
> 30 years ago.  Whatever the motivation may have been at that
> time, there is no incentive to change the rules now;  compilers
> already give diagnostics in such cases, even though they don't
> have to.  Changing the rules would mean throwing away a degree
> of freedom with no significant benefit.

It would remove a degree of freedom for implementers, one that few if
any currently take advantage of.  Meaningless degrees of freedom for
implementers do not help users.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.std.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

int n = {{0}}; Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-10-26 19:57 -0700
  Re: int n = {{0}}; Richard Damon <Richard@Damon-Family.org> - 2023-10-28 09:41 -0700
  Re: int n = {{0}}; Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-12-03 11:23 -0800
    Re: int n = {{0}}; Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-12-03 14:00 -0800
      Re: int n = {{0}}; Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-18 17:52 -0800

csiph-web