Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903283

Consider adding support for variable-length arrays

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • 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.



            sundar Sundararajan Athijegannathan
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: