Ticket #2 (assigned defect)
ISO C++ forbids zero-size array 'iso_packet_desc'
|Reported by:||dsd||Owned by:||hjelmn|
libusb.h causes errors in C++ projects that use GCC's -pedantic switch:
error: ISO C++ forbids zero-size array 'iso_packet_desc'
One solution is to make the array size 1 and account for that change in all places that use sizeof(struct libusb_transfer), e.g.: int alloc_size = sizeof(struct usbi_transfer) + sizeof(struct libusb_transfer) + (sizeof(struct libusb_iso_packet_descriptor) * (iso_packets-1)) + os_alloc_size;
OK. Then I have a possible solution which I don't completely dislike: use an #ifdef to make the array size 1 when using a C++ compiler, but leave the other situations as-is. Outside of the header file, no libusb changes are needed since libusb will always be compiled with a C compiler. What do you think?
comment:5 in reply to: ↑ 4 Changed 4 years ago by hjelmn
- Milestone set to 1.0.16
- Owner set to hjelmn
- Status changed from new to assigned
Note: See TracTickets for help on using tickets.