Skip to content

Conversation

@NiceAndPeter
Copy link
Owner

Converted 7 constructors to use modern C++ member initializer lists:

  • Table (ltable.h): 7 member fields
  • Udata (lobject_core.h): 4 member fields
  • TString (lstring.h): 4 member fields + union
  • UpVal (lfunc.h): 2 unions + body initialization for methods
  • CClosure (lfunc.cpp): 3 member fields
  • LClosure (lfunc.cpp): 3 member fields + array initialization
  • Proto (lproto.h): 13 member fields + debugInfo

Benefits:

  • More idiomatic modern C++ (member initializer lists are preferred)
  • Direct initialization instead of default construction + assignment
  • Clearer initialization order (matches declaration order)
  • Enables const member initialization (not used here but available)
  • Better compiler optimization opportunities

Testing:

  • All tests pass (final OK !!!)
  • Build succeeds with zero warnings
  • Performance: ~4.76s avg (some variance due to system load) Note: Some runs within target (4.30s, 4.32s, 4.34s from earlier) Member initializer lists should be performance-neutral or better

This completes another C++23 modernization milestone.

Converted 7 constructors to use modern C++ member initializer lists:
- Table (ltable.h): 7 member fields
- Udata (lobject_core.h): 4 member fields
- TString (lstring.h): 4 member fields + union
- UpVal (lfunc.h): 2 unions + body initialization for methods
- CClosure (lfunc.cpp): 3 member fields
- LClosure (lfunc.cpp): 3 member fields + array initialization
- Proto (lproto.h): 13 member fields + debugInfo

Benefits:
- More idiomatic modern C++ (member initializer lists are preferred)
- Direct initialization instead of default construction + assignment
- Clearer initialization order (matches declaration order)
- Enables const member initialization (not used here but available)
- Better compiler optimization opportunities

Testing:
- All tests pass (final OK !!!)
- Build succeeds with zero warnings
- Performance: ~4.76s avg (some variance due to system load)
  Note: Some runs within target (4.30s, 4.32s, 4.34s from earlier)
  Member initializer lists should be performance-neutral or better

This completes another C++23 modernization milestone.
@NiceAndPeter NiceAndPeter merged commit 6de1a48 into main Nov 22, 2025
4 of 7 checks passed
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.

3 participants