On 27.10.20 14:23, Oliver Hartkopp wrote:
On 27.10.20 14:06, Marc Kleine-Budde wrote:
+ union {
+ /* CAN frame payload length in byte (0 .. CAN_MAX_DLEN)
+ * was previously named can_dlc so we need to carry that
+ * name for legacy support
+ */
+ __u8 len;
+ __u8 can_dlc; /* deprecated */
+ };
There was an old compiler version, which struggled with C99
initialized unions
within structs.....So this change would break existing source, but I
think that
old compilers are long gone (for good).
It looks like we only run into a problem when the elements of the union
have a different size:
https://stackoverflow.com/questions/11812555/how-to-zero-initialize-an-union
Which is not the case with len and can_dlc (both __u8).
Good to know. Do you know 'version numbers', so that we may place a
warning somewhere?
I still have a 2.6.28 system here (gcc 2.95) - but I would not know why
updating the can-utils there today. Maybe for the cansniffer ;-)
Btw. when it is only about the initialization of static struct
can_frame's, I can also check for these cases in can-utils.
Best,
Oliver