OdysseyDecomp
OdysseyDecomp copied to clipboard
Custom linter: Constructors without body and initializer list as `= default;`
// Bad:
StageSwitchInfo::StageSwitchInfo() {}
// Instead:
StageSwitchInfo::StageSwitchInfo() = default;
// This does not compile:
StageSwitchInfo::StageSwitchInfo(s32 x) : mMember(x) = default;
It seems like when there's a header defined ctor, the inlined version of that ctor can sometimes be optimized differently when it's defined with {} instead of = default, meaning that for header defined ctors with {}, the switch to = default can sometimes cause a mismatch. Here are two examples of ctors where making this change causes a mismatch: https://github.com/MonsterDruide1/OdysseyDecomp/blob/21a4852f75b3c2ce99112e35a2fb9824c54900ec/lib/al/Project/Camera/CameraSubTargetTurnParam.h#L10 and https://github.com/MonsterDruide1/OdysseyDecomp/blob/21a4852f75b3c2ce99112e35a2fb9824c54900ec/lib/al/Library/Camera/CameraPoser.h#L109
Ig I can just modify the lint I made for this to ignore headers, but I wanted to point this out
= default was added in C++11. If this is a point of accuracy, many of the classes within ActionLibrary were created during the Wii/3DS/Wii U era and none of their compilers supported C++11 at the time of each game's release. There's a whole half of the game where we can verifiably say that they didn't use it before Odyssey. If they replaced them during Odyssey's development for some reason, we wouldn't know anyway. It's important to keep this in consideration in case an earlier ActionLibrary game like 3DW U or 3DL receives a significant decomp effort, because its easier to not have to find/replace things.