Article View: comp.lang.c
Article #1269Re: p = {1,0,0}
From: fir
Date: Mon, 02 Nov 2026 19:56
Date: Mon, 02 Nov 2026 19:56
83 lines
4171 bytes
4171 bytes
fir pisze:
> bartc pisze:
>> On 02/11/2026 16:36, David Brown wrote:
>>> On 01/11/2026 14:41, bartc wrote:
>>>> On 01/11/2026 13:32, fir wrote:
>>>>> it is maybe banal but sometimes banal remarks also maybe should be
>>>>> stated as i dont remember if i even was posting on that
>>>>>
>>>>> the fact stat some cannot assign a structure like
>>>>> this
>>>>>
>>>>> s = {x,y};
>>>>>
>>>>> seems rather silly (especially as structures can be assigned/copied)
>>>>>
>>>>> with this {0,0,1} at least c has a basic of ths vector/tupple support
>>>>> and this 'native' support is quite standable..so its very weird it
>>>>> is 'blocked' from usage
>>>>
>>>>
>>>> #include <stdio.h>
>>>>
>>>> typedef struct {int x,y;} T;
>>>>
>>>> int main(void) {
>>>> T s;
>>>> s = (T){10,20};
>>>> }
>>>>
>>>
>>> As often seems to be the case, things Fir wants are already available
>>> in C++.
>>>
>>> In C, you need to give a type to "{ 10, 20 }" - as you did here,
>>> making it into a compound literal. The expression "{ 10, 20 }" on
>>> its own cannot be used for assignment to "s" because the type of an
>>> expression must be determined from the expression alone - not from
>>> what you are assigning it to.
>>
>> I think this has been discussed recently but I can't remember the
>> arguments.
>>
>> But people can write:
>>
>> x = 0;
>>
>> and the exact type of '0' can be determined from the type of 'x', so I
>> don't see much difference.
>>
>> Plus it doesn't see to be a problem here:
>>
>> T s = {10, 20};
>>
>> What determines the type of {10, 20} in this case?
>>
>>>
>>> In C++, "s = { 10, 20 };" is valid because "{ 10, 20 }" is treated as
>>> type std::initializer_list<int> (the "int" part is automatically
>>> inferred). Making this work involves quite a bit of additional C++
>>> machinery that does not exist in C.
>> In the language or compiler? Because machinery can be added to C too.
>>
>>
> you once asked if i want some of what i talk someone should implement
> etc...
>
> in fact i dont care those are some observations, and i may wait
> implement it myself but also someone (espe like c comitee) could
> implement it imo (some of it those closer to c)
>
> but it geerally seems this comitee is don bad work
>
> ythse some basic changes and obvious exchanges like hera baove
> or this that 'bhdbdh' would work they should do
>
> i think what not breaks compatibility and what is really sane and not
> rises special objections they should do
im not even specially interested in what not breaks this compatibility
with old sources but even thse major changes (like definitions being
seen down in code) they could also add
Technical Details
Message-ID:
<11capsj$363bd$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me> <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me> <11capp5$363bd$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: p = {1,0,0}
Date: Mon, 2 Nov 2026 20:56:03 +0100
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <11capsj$363bd$2@dont-email.me>
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me>
<11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me>
<11capp5$363bd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 02 Nov 2026 19:56:04 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="3345773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mEMZR+Ss+be+alHkrGG24M6Zsak+uFGo="; posting-host="ce6fef86b3aebbeff91418ef04e0ba5a"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:U4foGX3cNl23N1fna4y7I059WGI= sha256:iDL7B2aXYYT97G92AWaSJU9jUwvZuv9D0HzyXvMqkls=
sha1:c3GfXcOu6c4SXnTQXuxnq4PJRmk= sha256:W781iUFltjWN5Cj2NPn+uANXw0cHoql1Ga1q00seB44=
In-Reply-To: <11capp5$363bd$1@dont-email.me>