VLA parameters

shiv 00shiv@gmail.com
Mon Jun 29 02:13:00 GMT 2015


I wonder if I missed this in the manual somewhere, since it seems to imply
otherwise. Thanks for clearing it up. --shiv--

On Sun, Jun 28, 2015 at 12:48 PM Jonathan Wakely-4 [via gcc] <
ml-node+s1065356n1163577h9@n5.nabble.com> wrote:

> On 28 June 2015 at 20:21, shiv <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=1163577&i=0>> wrote:
>
> > Reading the gcc 5.1 manual it seems that VLA parameters must be accepted
> by
> > g++. For example the following is fine when compiled with gcc
> --std=gnu11
> >
> > ///////////////////////////////////
> > float sum (int M, float x[M]) {
> >   return x[0] + x[1];
> > }
> >
> > int main (void) {
> >   float xs[2] = {1, 2};
> >   float acc = sum (2, xs);
> >   return 0;
> > }
> > /////////////////////////////////
> >
> > But it is rejected by g++ --std=gnu++11.
> >
> > Is this possible at all with g++? Thanks.
>
> No, I don't think so, G++ only supports some kinds of VLA.
>
> You have to use float x[] or float* x in C++.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://gcc.1065356.n5.nabble.com/VLA-parameters-tp1163574p1163577.html
>  To unsubscribe from VLA parameters, click here
> <http://gcc.1065356.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1163574&code=MDBzaGl2QGdtYWlsLmNvbXwxMTYzNTc0fC0xOTgzODE4MTM1>
> .
> NAML
> <http://gcc.1065356.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://gcc.1065356.n5.nabble.com/VLA-parameters-tp1163574p1163612.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list