2 Replies Latest reply: Jul 5, 2011 10:24 AM by user13277775 RSS

    Variable Length Arrays

    RogerP
      I am trying to compile a program that uses the GNU extension for variable arrays, which apparently are not allowed in SUN Studio yet. On the suggestion of a post I saw I tried to substitute the code:

      char cline[par::MAX_LINE_LENGTH];

      with

      char** cline = (char **) alloca(sizeof(*str)*MAX_LINE_LENGTH);

      but got on an error with the following statement:

      // convert to string
      string sline = cline;

      What can I do to make this work? Is there anyway to incorporate the GNU extensions into SUN Studio?

      Thanks,
      Roger