EVerest / cbexigen

cbExiGen - The V2GTP EXI codec generator for cbV2G
Apache License 2.0
32 stars 18 forks source link

suggest to use bracket for defining of added constants(lengh, size, ...) #61

Closed kwoyhope closed 10 months ago

kwoyhope commented 10 months ago

IMH, it would be better to use a bracket for preventing code error(unwanted behavior).

ex) #define iso2_MimeType_CHARACTER_SIZE EXI_STRING_MAX_LEN + ASCII_EXTRA_CHAR // 64 + 1, without bracket printf("iso2_MimeType_CHARACTER_SIZE 2 = %d\r\n", iso2_MimeType_CHARACTER_SIZE 2);

iso2_MimeType_CHARACTER_SIZE 2 = 66 // not 130 ((64+1) 2), but 66 (64 + (1 * 2))

I know that there's no reason to coding like above actually(but possible?), it's just my suggestion.

barsnick commented 10 months ago

Interesting use case there. ;-)

In principle, you are absolutely correct. We know of all internal uses, and they are safe (so far), and we followed the style of OpenV2G. But we should probably change this, for the sake of cleanness.