Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #82975

Re: Understanding default member initializers of constructorless structs

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: Understanding default member initializers of constructorless structs
Date 2022-02-09 07:26 +0000
Organization Aioe.org NNTP Server
Message-ID <stvqbi$1ulv$1@gioia.aioe.org> (permalink)
References <sttgpr$1cud$1@gioia.aioe.org> <stu29c$v3$1@dont-email.me>

Show all headers | View raw


Andrey Tarasevich <andreytarasevich@hotmail.com> wrote:
> Aggregate initialization in C++ never used any "constructors" at the top 
> level. It is a separate built-in initialization mechanism with its own 
> custom specification. So, in C++14 this specification was simply 
> modified to take into account default initializers:
> 
> 8.5.1 Aggregates
> 7 If there are fewer initializer-clauses in the list than there are 
> members in the aggregate, then each member not explicitly initialized 
> shall be initialized from its brace-or-equal-initializer or, if there is 
> no brace-or-equalinitializer, from an empty initializer list (8.5.4).

I see. It makes sense. (Although I wonder how they didn't think of that
when they were standardizing C++11.)

Also, I think someone should update the cppreferece.com page to include
this information.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Understanding default member initializers of constructorless structs Juha Nieminen <nospam@thanks.invalid> - 2022-02-08 10:31 +0000
  Re: Understanding default member initializers of constructorless structs "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-02-08 11:55 +0100
    Re: Understanding default member initializers of constructorless structs Juha Nieminen <nospam@thanks.invalid> - 2022-02-08 12:37 +0000
      Re: Understanding default member initializers of constructorless structs red floyd <no.spam.here@its.invalid> - 2022-02-08 10:56 -0800
  Re: Understanding default member initializers of constructorless structs Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-02-08 07:29 -0800
    Re: Understanding default member initializers of constructorless structs Juha Nieminen <nospam@thanks.invalid> - 2022-02-09 07:26 +0000

csiph-web