bloomberg / rmqcpp

A batteries included C++ RabbitMQ Client Library/API.
Apache License 2.0
68 stars 16 forks source link

Use bsl::memcpy to fix strict aliasing errors #18

Closed ahsanabbas123 closed 11 months ago

ahsanabbas123 commented 11 months ago

Problem statement

While building with vcpkg on linux x86_64, we get errors due to strict aliasing not being complied with - as mentioned in https://github.com/microsoft/vcpkg/pull/34797.

error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  379 |             *reinterpret_cast<const bsl::uint64_t*>(&val); 

Proposed changes

We use bsl::memcpy instead.