Use QUOTEDSTRLEN macro instead of sizeof or strlen

This commit is contained in:
Rangi42
2024-03-27 11:50:48 -04:00
parent 912a1504ec
commit dcb4e40388
5 changed files with 16 additions and 11 deletions

View File

@@ -86,6 +86,9 @@ static inline int clz(unsigned int x) {
// For lack of <ranges>, this adds some more brevity
#define RANGE(s) std::begin(s), std::end(s)
// MSVC does not inline `strlen()` or `.length()` of a constant string, so we use `sizeof`
#define QUOTEDSTRLEN(s) (sizeof(s) - 1)
// For ad-hoc RAII in place of a `defer` statement or cross-platform `__attribute__((cleanup))`
template<typename T>
struct Defer {