Skip to content

Fix accessing uninitialized member#177

Open
safocl wants to merge 1 commit intoaewallin:masterfrom
safocl:fix-accessing-uninitialized-member
Open

Fix accessing uninitialized member#177
safocl wants to merge 1 commit intoaewallin:masterfrom
safocl:fix-accessing-uninitialized-member

Conversation

@safocl
Copy link

@safocl safocl commented May 26, 2025

accessing to uninitialized member is undefined behavior (if member function setTolerance is not called).

if((p - *p1).norm() < tol) {

here member tol is erroneous value or indeterminate value

https://eel.is/c++draft/defns.undefined
https://eel.is/c++draft/basic.indet#2
https://eel.is/c++draft/dcl.init.general#1
https://eel.is/c++draft/dcl.init#general-12
https://eel.is/c++draft/dcl.init#general-7.1
https://eel.is/c++draft/class.base.init
https://eel.is/c++draft/class#base.init-example-6

simple example:
https://godbolt.org/z/7s1YEfqhG

please select one of the explicit initialization options for the class member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant