Type Punning in C and C++

(blog.pwkf.org)

28 points | by ingve 1 hour ago

5 comments

  • pipe01 1 minute ago
    Is it necessary to use the lowest possible font weight?
  • eqvinox 5 minutes ago
    The example included below "Why C and C++ Differ" is UB in both C and C++ (and says nothing about "why" C & C++ differ). The article isn't overall wrong but that bit is just...

    (Feels a bit like LLM junk, but honestly not sure.)

  • antiloper 38 minutes ago
    > The C vs C++ distinction here is genuinely treacherous

    What's so genuine about this?

    • tialaramex 21 minutes ago
      Despite the fact they're two different languages, people are often taught as though it's basically just a subset relationship and then they carry this through into the actual software they write.

      Because neither of these are memory safe languages, you are required to ensure you've made no mistakes or else anything might happen.

    • ndr 14 minutes ago
      It continues with

      > and most blog posts on the topic get it wrong.

      This smells like Claudism/LLMish.

  • K0IN 55 minutes ago
    Does reinterpret_cast works in c++ for this?
  • jefftk 8 minutes ago
    [flagged]