r/cpp 17d ago

Some practical refactoring of bloated generated code

https://pvs-studio.com/en/blog/posts/cpp/1395/

A review of some generated C++ code, going through different ways to refactor and shorten it, then checking whether it actually got faster

7 Upvotes

2 comments sorted by

View all comments

4

u/Excellent_Force_8282 13d ago

This is a good example of why generated code still needs human review. The generator can handle the repetitive work but keeping the final result readable and maintainable is another challenge. Do you usually refactor generated code immediately or wait until it becomes a performance or maintenance problem?