Welcome

SweSTHLM1

StockholmCpp 0x35

scppQR

Today’s sponsor

 

excillum logo

C++ news

 

C++ news

Unofficial C++ trip report repo on GH πŸŽ‰

cppTripReport

πŸŽ‡ No more reddit post πŸŽ‡
(still links to the old ones)

C++ news

C++ news

Next SG21 meeting, June in Sofia

⇒ N5004

C++ news

C++ news

Eco System Evolution

ecostdQR3

C++ news

Beman Project

beman1000

TK611/AG09

 

SwedenCpp News

SwedenCpp

StockholmCpp Planning 2025

 

  • 8th May

  • 12th June

  • End of August

Call for Papers

Submit your ideas and suggestions

needyou

Tell us what you want to hear or want to do

Call for Participation

whowants

Quiz time

JetBrainsLicense

Quiz time

Some C interface, 2 KB embedded storage

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

Quiz time

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?

Quiz time

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));

Quiz time

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)

Quiz time

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

Today’s program

 

  • Anders: Low, Lower, Lowest level Programming

  • 🍹 πŸ• Mingle πŸ• 🍻

  • Eric: A (pseudo) random talk

VΓ€l mΓΆtt!