Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #389220
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: 80386 C compiler |
| Date | 2024-11-29 21:00 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <865xo5pb8b.fsf@linuxsc.com> (permalink) |
| References | (7 earlier) <20241127112746.171@kylheku.com> <vi7tmc$4ur3$4@dont-email.me> <20241127134839.469@kylheku.com> <vi88n4$74j9$1@dont-email.me> <20241128201403.206@kylheku.com> |
Kaz Kylheku <643-408-1753@kylheku.com> writes:
> On 2024-11-27, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>
>> If there weren't a rule mandating the order in which initializers
>> were applied, when two or more initializers affect the same
>> object, it wouldn't be possible to be certain which one overrode
>> the others.
That's wrong. The priority rule for initializing the same subobject
depends not on order of evaluation but on syntactic order. There
doesn't have to be a rule for evaluation order to make the order
of subobject overriding be well defined.
> It would make sense for that simply to be a constraint violation;
> two initializations for the same object are being requested.
It isn't that simple. There are situations where overriding the
initialization of a particular subobject makes sense, and is
useful. Example:
typedef struct { int x, y; } Bas;
typedef struct { Bas b[2]; } Foo;
Foo
sample_foo( Bas b ){
Foo foo = { b, b, .b[1].y = -1 };
return foo;
}
The subobject .b[1].y is overridden, but we can't take the previous
initialization of .b[1] without changing the semantics.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-27 19:42 +0000
Re: 80386 C compiler James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-27 14:59 -0500
Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-27 21:52 +0000
Re: 80386 C compiler James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-27 18:07 -0500
Re: 80386 C compiler Kaz Kylheku <643-408-1753@kylheku.com> - 2024-11-30 01:30 +0000
Re: 80386 C compiler Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-11-29 21:00 -0800
Re: 80386 C compiler James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-11-30 09:00 -0500
Re: 80386 C compiler David Brown <david.brown@hesbynett.no> - 2024-11-28 09:12 +0100
csiph-web