mindly.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mindly.Social is an English speaking, friendly Mastodon instance created for people who want to use their brains and their hearts to make social networking more social. 🧠💖

Administered by:

Server stats:

1.2K
active users

#tips

20 posts19 participants2 posts today

It’s not just the screen time, it’s how we use social media before bed that messes with our sleep! 😴

From doomscrolling to FOMO, emotionally charged posts keep our brains active, making it harder to unwind and fall asleep.

To improve sleep:
1️⃣ Avoid emotionally intense content 30-60 mins before bed.
2️⃣ Set your phone on "Do Not Disturb."
3️⃣ Mindfully check social media (or skip it entirely!).

theconversation.com/social-med
#health #wellness #sleep #tips #socialmedia

Tip 83 of #TuesdayCodingTips - Curious case of NLOHMANN_JSON_SERIALIZE_ENUM

I recently debugged a case where code generated by NLOHMANN_JSON_SERIALIZE_ENUM failed at invariant assertions deep in the nlohmann_json library. When examined under a debugger, the data looked in line with the invariants, but there were different from what I expected.

Upon expanding the macro, I found a static const array in the generated function body. This was suspicious as I knew the code is running multiple serializations in parallel and that static array was the only shared state between threads.

But the C++ standard clearly states such initialization is thread-safe! Except that our project had a particular MSVC flag set - /Zc:threadSafeInit- (which disables thread-safe initialization), for good reasons I can't talk about.

Takeaway - the problem isn't always in the code itself. Trust your gut feeling and dive into the compiler flags as well!