Use QUOTEDSTRLEN macro instead of sizeof or strlen

This commit is contained in:
Rangi42 committed 2024-03-27 11:50:48 -04:00
1 parent 912a1504ec
commit dcb4e40388
5 files changed
+16 -11

No files matched your search

+3
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 {