approvals / approvals/ApprovalTests.cpp

Use constexpr to define version numbers, not #define

Open
#107 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

breaking_change on_hold
Dominant language
C++
Stars
339
Forks
55
PR merge metrics
No merged PRs in 30d

Description

This arose out of #91.

It would be better to use constexpr instead of #define to define the version number components of this project in code - for type-safety.

Not everyone who uses this project uses it with CMake, so I would stick with our current structure - but I see that constexpr is a nicer - type-safe - way of setting the various version numbers...

I'll set up a separate issue to convert the #define approach in to constexpr instead...

Originally posted by @claremacrae in https://github.com/approvals/ApprovalTests.cpp/issues/91#issuecomment-589946545

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the project’s version-number #define declarations and review issue #91 for the original context. Replace the version components with type-safe constexpr definitions, preserving the current structure for users who do not use CMake, and verify that existing version-related checks still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
release
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.