Re: SWIG: Bug with 'C' arrays of zero size ?
"Alberto Luaces" <[email protected]>
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jun 12, 2020, at 10:37, Terry Barnaby wrote:
> Hi,
>
> If you have a data structure like the following all is well:
>
> struct DataBlock {
> Header header;
> char data[4]; ///< The packet data
> };
>
> However if you have a data structure that has a zero length array like
> the following, SWIG considers the "char data[]" as a pointed to data and
> tries to delete[] and allocate memory for it.
>
> struct DataBlock {
> Header header;
> char data[]; ///< The packet data
> };
>
> I think this is a bug ?
Are you using C++? It seems that zero-sized arrays are not allowed:
https://stackoverflow.com/questions/6180012/array-with-size-0#6180200
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user