Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:16:54+00:00 2026-05-30T12:16:54+00:00

I was wondering about an initialization of the following form: int array[] = {

  • 0

I was wondering about an initialization of the following form:

int  array[] = {
v - 1,
array[0] + 1
} ;

In the initialization of the second element, the value of the first is used, but the entire array is not yet initialized. This happens to compile with g++, but I was unsure whether this is actually portable and a well defined construct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:16:55+00:00Added an answer on May 30, 2026 at 12:16 pm

    See 3.3.2 Point of declaration:

    The point of declaration for a name is immediately after its complete declarator (Clause 8) and before its
    initializer (if any), except as noted below. [ Example:

    int x = 12;
    { int x = x; }
    

    Here the second x is initialized with its own (indeterminate) value. —end example ]

    So you are referring to the array correctly, its name is known after the =.

    Then, 8.5.1 Aggregates:

    An aggregate is an array or a class […]

    17: The full-expressions in an initializer-clause are evaluated in the order in which they appear.

    However, I see no reference to when the evaluated values are actually written into the array, so I wouldn’t rely on this and would even go so far to declare your code as not well defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been wondering about the language in the C++03 specification surrounding object initialization, specifically
I was wondering about the best way to implement a Confirm Page upon form
I was wondering about using or not templates, in other thread I found out
I have always been wondering about why in the following example it is OK
I read about this Article I wondering about this part: try { //First try
I was wondering about something very basic but that I haven't been able to
I was just wondering about the technology used in Soundcloud's audio track streaming feature.
Just wondering about the performance impact of copying very large php variables. For example
I'm wondering about instances when it makes sent to use #define and #if statements.
I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.