int persist(uint8_t slot, int64_t value);
int64_t retrieve(uint8_t slot);


Unofficial C++ trip report repo on GH π

π No more reddit post π
(still links to the old ones)
⇒ like, share, follow, subscribe
8th May
12th June
End of August
Submit your ideas and suggestions

Tell us what you want to hear or want to do


Some C interface, 2 KB embedded storage
int persist(uint8_t slot, int64_t value);
int64_t retrieve(uint8_t slot);Today we do
double cool_val = 42.43;
int64_t* tmp = (int64_t*)&cool_val;
persist(0, *tmp);Tomorrow we do
int64_t tmp = retrieve(0);
double cool_val = *(double*)&tmp;Is that a good idea?
so we do
double cool_val = 42.43;
int64_t tmp = 0;
memcpy(&tmp, &cool_val, sizeof(tmp));
persist(0, tmp);and tomorrow we do
int64_t tmp = retrieve(0);
double cool_val = 0.0;
memcpy(&cool_val, &tmp, sizeof(cool_val));what we want to do
double cool_val = 42.43;
persist(0, std::abc_defg<int64_t>(cool_val));and tomorrow we want to do
double cool_val = std::abc_defg<double>(retrieve(0));
What is abc_defg?
(that is the Quiz question)
since C++20
double cool_val = 42.43;
persist(0, std::bit_cast<int64_t>(cool_val));include <bit>
double cool_val = std::bit_cast<double>(retrieve(0));std::bit_cast
Anders: Low, Lower, Lowest level Programming
πΉ π Mingle π π»
Eric: A (pseudo) random talk
VΓ€l mΓΆtt!