Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Delphi-News aus aller Welt (https://www.delphipraxis.net/58-delphi-news-aus-aller-welt/)
-   -   static_cast vs dynamic_cast: undefined behavior (https://www.delphipraxis.net/208135-static_cast-vs-dynamic_cast-undefined-behavior.html)

DP News-Robot 16. Jun 2021 11:00

static_cast vs dynamic_cast: undefined behavior
 
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even">Do not use static_cast when you cast from a basic class to a derived one! This may lead to undefined behavior. Always use dynamic_cast instead. Example (works with GCC, VC and online C++ shells):


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:51 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz