Groups | Search | Server Info | Login | Register


Groups > comp.std.c > #6618

Re: int n = {{0}};

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.std.c
Subject Re: int n = {{0}};
Date 2023-12-03 14:00 -0800
Organization None to speak of
Message-ID <878r6b3q0o.fsf@nosuchdomain.example.com> (permalink)
References <8734xwkc1c.fsf@nosuchdomain.example.com> <86cyvnw0n4.fsf@linuxsc.com>

Show all headers | 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