Consider adding support for variable-length arrays

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: tools

      Sometimes, C structs contain a trailing variable-length array:

      ```
      struct foo {
          int length;
          char name[]; // size is 'length'
      };
      ```

      If we give this to jextract we obtain the attached declaration. There are few issues with it:

      * the static allocate methods just allocate a "bare" struct with no space for the array. Instead the allocate methods could accept the length of the trailing array, and allocate enough space for the struct + array

      * there is no getter/setter for the variable-length array elements. These can be added easily - if the supplied segment is too small, an out of bound error will occur.

      These changes could make working with VLAs a bit easier.



            Assignee:
            Sundararajan Athijegannathan
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: