libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] ABI problem with: [PATCH v2] add multi extent ISO9660 fi


From: Thomas Schmitt
Subject: [Libcdio-devel] ABI problem with: [PATCH v2] add multi extent ISO9660 file support to libcdio
Date: Wed, 27 Jun 2018 12:22:09 +0200

Hi,

sorry, my demand to move the new members to the end of iso9660_stat_s
is poisonous.

Currently it looks like we will have to choose between a SONAME version
jump and implementing a complete new class for the ISO 9660 objects
which are currently represented by struct iso9660_stat_s.

See what's wrong with appending new members to iso9660_stat_s:

While pondering methods to avoid memory leaks with dynamic memory,
i came to this gesture in include/cdio/iso9660.h:

  #ifndef EMPTY_ARRAY_SIZE
  #define EMPTY_ARRAY_SIZE 0
  #endif
  ...
  struct iso9660_stat_s { /* big endian!! */
    ...
    char         filename[EMPTY_ARRAY_SIZE]; /**< filename */
  }

What ?
Google:

  https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
  "Declaring zero-length arrays is allowed in GNU C as an extension.
   A zero-length array can be useful as the last element of a structure
   that is really a header for a variable-length object"

  
https://stackoverflow.com/questions/9722632/what-happens-if-i-define-a-0-size-array-in-c-c
  "C99 6.7.2.1, ยง16: As a special case, the last element of a structure
   with more than one named member may have an incomplete array type;
   this is called a flexible array member.

So the opportunity to expand iso9660_stat_s in an ABI compatible way is
already used up. (Damn ingenious programming ! The fine art must be in the
model, not in the code.)


Have a nice day :)

Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]