Skip to content

Article and executable discussing C++ casting mechanics and recommendations.

License

Notifications You must be signed in to change notification settings

Doulos/cpp_casting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp_casting - Guidelines for avoiding C++ casting issues

This directory contains code related to an article of the same title in the Doulos KnowHow section of the Doulos website. Doulos provides training on a variety of topics including C++.

Written by David C Black, Senior Member Technical Staff at Doulos.

/knowhow

Search Doulos KnowHow for the very latest information.

How to build

You can likely just compile the cpp_casting.cpp file with your normal switches; however, we recommend using all warnings and pedantic options available to you and suppressing nothing. The accompanying CMakeList.txt and related cmake/*.cmake will do this rather simply.

Tools required:

To use cmake, you will of course need have cmake available. We assume version 3.21 or better. Go to https://cmake.org for more information.

Linux/macos commands to do the work:

# Configure and generate
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug

# Compile and link
cmake --build build/debug --config Debug
# You should see at least two warnings

# Execute the test
ctest --test-dir build/debug -C Debug -VV

Enjoy!

About

Article and executable discussing C++ casting mechanics and recommendations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published