DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Troubleshooting a Crash Triggered by Clang Compiler Optimization

4 years ago dzone.com

Summary: This is a summary of an article originally published by the source. Read the full original article here →

If someone told you that the following C++ function would cause the program to crash, what would you think it is that caused the problem?

It seems like we can get such a conclusion: Because the bool type parameter b of the b2s function was not initialized, the value stored in b is neither 0 nor 1, and that caused the problem.

If that interests you, change the type of b from bool to char or int and the problem will be fixed.

The C++ standard requires a bool type value to represent at least two states: true and false, but does not specify the sizeof(bool).

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com