OpenEtherCATsociety / SOES

Simple Open Source EtherCAT Slave
Other
559 stars 244 forks source link

Fix Wconversion issues for clang #150

Closed nakarlsson closed 1 year ago

nakarlsson commented 1 year ago

Add explicit uint16_t cast for EoE header SET macros. Used for SET of FrameInfo 1 and FrameInfo 2.

Increase datatype for offset used by EOE_HDR_FRAME_OFFSET_GET.

Change debug print formatting to %u for unsigned datatypes.

nakarlsson commented 1 year ago

@ArthurKetels , I'd like to get an OK from you as well before adding the use of

nakarlsson commented 1 year ago

Ping @ArthurKetels

ArthurKetels commented 1 year ago

Although I really hate the readability of the change it is an acceptable compromise. A better alternative would have been an upgraded printf that just writes the correct data type instead of making subtle changes.

For me clearly written code prevents more bugs than chasing pedantic compiler warnings. We are coding in C, an old language with warts and spots, not Rust or something like that.

Other than that, please make it so.

nakarlsson commented 1 year ago

For me clearly written code prevents more bugs than chasing pedantic compiler warnings. We are coding in C, an old language with warts and spots, not Rust or something like that.

Point taken.