☟☟ Upcoming C++ Best Practices – Tools online seminar, March 8th! ☟☟

Notes and info about episode:
Ep 188 – C++20’s `constexpr` `new` Support –

T-SHIRTS AVAILABLE!

► The best C++ T-Shirts anywhere!

WANT MORE JASON?

► My Training Classes:
► Follow me on twitter:

SUPPORT THE CHANNEL

► Patreon:
► Github Sponsors:
► Paypal Donation:

GET INVOLVED

► Video Idea List:

JASON’S BOOKS

► C++ Best Practices
Amazon Paperback:
Leanpub Ebook:

JASON’S PUZZLE BOOKS

► Object Lifetime Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:

► Object Lifetime Puzzlers Book 2
Amazon Paperback:
Leanpub Ebook:

► Object Lifetime Puzzlers Book 3
Leanpub Ebook:

► Copy and Reference Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:

► Copy and Reference Puzzlers Book 2
Amazon Paperback:
Leanpub Ebook:

► Copy and Reference Puzzlers Book 3
Leanpub Ebook:

► OpCode Puzzlers Book 1
Amazon Paperback:
Leanpub Ebook:

RECOMMENDED BOOKS

► Bjarne Stroustrup’s A Tour of C++ (now with C++20/23!):

AWESOME PROJECTS

► The C++ Starter Project – Gets you started with Best Practices Quickly –
► C++ Best Practices Forkable Coding Standards –

O’Reilly VIDEOS

► Inheritance and Polymorphism in C++ –
► Learning C++ Best Practices –

✅ Camiseta De Futbol Baratas Player vs Fan | camisetasfutboleses

🛒 Cómprala aquí: https://www.pidecamisetas.com/

📸 Siguenos en Instagram: https://www.instagram.com/msy_es/

📲 WhatsApp: +86 166 5930 6369

👏 ¡Muchas gracias por ver el vídeo! 👏

🔴 LIKE & SUBSCRIBE 🔴

🔴 Keywords:Camisetas Copa Mundial de Fútbol

__

🏷️ TAGS:
CAMISETA Real Madrid 22/23
camisetasfutboleses
camisetasfutboleses.com
CAMISETAS FUTBOL SPAIN
CAMISETAS DE FUTBOL
CAMISETAS FUTBOL Baratas
CAMISETAS DE FUTBOL 2020
CAMISETAS DE FUTBOL 2021
CAMISETAS DE FUTBOL 2022
CAMISETAS FUTBOL EQUIPOS
CAMISETAS FUTBOL SELECCIONES
CAMISETAS DE FUTBOL BARATAS
MEJORES CAMISETAS DE FUTBOL
EQUIPACIONES FUTBOL
EQUIPACIONES DE FUTBOL

Otros sitios web de nuestra empresa para que los visite:

17 comentarios en «C++ Weekly – Ep 363 – A (Complete?) Guide To C++ Unions»
  1. When you call destructor "s.std::string::~string();" What is this function call exactly and how to read this? I thought you would call destructor for local variable with "s.~string()". What am I missing?

  2. One thing I don't understand is this idea of the "active member of a union". At runtime I don't think this concept exists, if you modify the int and you access the float, you get the float that is represented by the same bits you set on the int, and that's totally normal behavior and there's nothing UB about it as far as I know. How come at compile time these rules change? Feels like union at compile time just cannot really be sensibly used.

  3. It's nice that we can't have UB in constant expression context due to C++ standard expr.const. If we can write the code that will executed in constexpr context we'll have no UB in this code. I'm starting to think it's safer than situation in some other language in which UB can take place not only in some blocks but because of these blocks (somewhere safe)

  4. I think that if you have a union of say, two structs with common initial sequence of object (same type), you are allowed to de reference values of this common sub sequence. Say, union U { struct A {int A_; } an_a; struct B {int B_; } a_b; }; U a_u; a_u.an_a.a; and a_u.a_b.b; is legal. This is the underlying principle of many C libraries, say when you manipulate addresses using the typical sockets API or Windows Bitmap header as an example. I would be appreciate input on the subject.

  5. Takeaway after 16 minutes: Don't bother using unions 🤣 A long time ago, I did exploit unions for implicit type conversions, but I haven't used any unions since then (i.e. for 25 years). The only place I encounter unions is STGMEDIUM and similar legacy Win-32 data types.

  6. You're funny. 14 of the 16 minute go to increasingly abstruse (but totally fascinating) stuff about unions, followed by the lesson that one shouldn't do this. Indeed: optional, variant, any, expected are much nicer.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *