Enforce compile-time type checking for option registration#4148
Enforce compile-time type checking for option registration#4148ahojnnes merged 1 commit intocolmap:maincolmap/colmap:mainfrom StonerLing:fix/template-unsupported-typeStonerLing/colmap:fix/template-unsupported-typeCopy head branch name to clipboard
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness of option registration by shifting type validation from runtime to compile-time. This change ensures that unsupported option types are detected during compilation, preventing potential runtime crashes and simplifying debugging. It also includes minor type adjustments in related executable files to align with these new compile-time checks, improving overall type safety. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request improves type safety for option registration by replacing a runtime error for unsupported types with a compile-time static_assert. This is a valuable change that makes errors easier to diagnose. As a consequence of size_t not being a supported option type, several options were changed from size_t to int. My review includes a comment discussing a potential issue with this change and suggests an alternative approach to consider.
|
Oh, thank you for this fix! |
Fixes #4147
Unsupported option types now fail at compile time via static_assert, making errors easier to diagnose and preventing unreachable runtime error paths.