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 7802897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:23:47+00:00 2026-06-02T01:23:47+00:00

A patch was posted to gcc that provides something called vector subscripting to g++

  • 0

A patch was posted to gcc that provides something called vector subscripting to g++ (gcc already had it).

If a is an array and i is an int then i[a] is legal and equal to a[i].

double a[]{0.0, 1.0, 2.0, 3.0}; // C++11 style but would work in C++98 style too.
assert(a[2] == 2.0);
assert(2[a] == 2.0);

So, is this legal and standard C/C++ or is it a gcc extension?

Actually, Google shows MS Developer Studio has this too. I looked in the C++ standard and didn’t see it though.

  • 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-06-02T01:23:48+00:00Added an answer on June 2, 2026 at 1:23 am

    The patch has nothing to do with i[a] being equivalent to a[i]; that has always been the case, in both languages. Unless user-defined types are involved, a[i] is defined as being equivalent to *(a+i), and addition is commutative.

    The patch concerns vector datatypes (not to be confused with the C++ std::vector class template), a GCC language extension to support vector processing instructions. According to the patch notes, they were subscriptable like arrays in C but not C++, and this patch adds that feature to C++.

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

Sidebar

Related Questions

RyanWilcox had posted a script at here , that can use the following command
I had posted another question earlier about deployment with Passenger. That problem turned out
I want to send .patch files that were generated by the git format-patch command
Some years ago here someone had posted some PHP code on a Boggle solver
I need to add a zero to the date value that is posted as
Someone posted a great little function here the other day that separated the full
Following is a question that is posted on http://dev.eclipse.org in April 2003. The original
How do pass back values to a form that was posted to the server
Guys i had posted a question earlier pypdf python tool .dont mark this as
I posted earlier about getting my VBScript to wait until a process had finished

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.