Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bad practice] Virtual functions are called inside some constructors/destructors #41

Open
dwatteau opened this issue Jan 9, 2022 · 0 comments

Comments

@dwatteau
Copy link
Owner

dwatteau commented Jan 9, 2022

(On top of PR #39, because it already removes more similar noise.)

clang-tidy appears to complain about some call to virtual functions inside some of our constructors and destructors:

src/common/file.cpp:68: Call to virtual method 'File::close' during destruction bypasses virtual dispatch
src/common/file.cpp:222: Call to virtual method 'File::read' during destruction bypasses virtual dispatch
src/common/file.cpp:292: Call to virtual method 'File::_zap' during destruction bypasses virtual dispatch
src/common/file.hpp:533: Call to virtual method 'SeqFile::close' during destruction bypasses virtual dispatch
src/ScummRp/block.cpp:956: Call to virtual method 'LFLFPack::_init' during construction bypasses virtual dispatch
src/ScummRp/block.cpp:1053: Call to virtual method 'LECFPack::_init' during construction bypasses virtual dispatch
src/ScummRp/block.cpp:2327: Call to virtual method 'OldRoomV1::_init' during construction bypasses virtual dispatch
src/ScummRp/block.cpp:2467: Call to virtual method 'OldRoomV2::_init' during construction bypasses virtual dispatch
src/ScummRp/block.cpp:2510: Call to virtual method 'OldRoomV2::_ooBX' during construction bypasses virtual dispatch
src/ScummRp/block.cpp:2636: Call to virtual method 'OldRoomV3::_init' during construction bypasses virtual dispatch
src/ScummRp/block.cpp:2679: Call to virtual method 'OldRoomV3::_ooBX' during construction bypasses virtual dispatch
src/ScummRp/toc.cpp:41: Call to virtual method 'TableOfContent::_zap' during construction bypasses virtual dispatch
src/ScummRp/toc.cpp:46: Call to virtual method 'TableOfContent::_zap' during destruction bypasses virtual dispatch
src/ScummRp/toc.cpp:414: Call to virtual method 'GlobalRoomIndex::_zap' during destruction bypasses virtual dispatch

I don't think I can fix this myself, though. Not enough knowledge of best C++ practices.

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

No branches or pull requests

1 participant