summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-10-14 16:02:25 +0200
committerTyge Løvset <[email protected]>2022-10-14 16:02:25 +0200
commitd26fd02b70b9f091c2bcfa350e420f74c1f023f8 (patch)
tree7ca2902ee839cb1ce7bfc3333f6ead2e4ea39ef2 /include
parent54c08dc031c622e78dc134353690ed359b9173d8 (diff)
downloadSTC-modified-d26fd02b70b9f091c2bcfa350e420f74c1f023f8.tar.gz
STC-modified-d26fd02b70b9f091c2bcfa350e420f74c1f023f8.zip
Replaced PRIuMAX with new c_zu macro in examples. "%zu" is not supported by mingw64 and PRIuMAX is not a replacement for "zu".
Diffstat (limited to 'include')
-rw-r--r--include/stc/carc.h2
-rw-r--r--include/stc/ccommon.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h
index d0adcceb..f0ab651b 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -43,7 +43,7 @@ int main() {
ArcPers p = ArcPers_from(Person_new("John", "Smiths"));
ArcPers q = ArcPers_clone(p); // share the pointer
- printf("%s %s. uses: %" PRIuMAX "\n", cstr_str(&q.get->name), cstr_str(&q.get->last), *q.use_count);
+ printf("%s %s. uses: %" c_zu "\n", cstr_str(&q.get->name), cstr_str(&q.get->last), *q.use_count);
c_drop(ArcPers, &p, &q);
}
*/
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index e3406727..394964c0 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -30,6 +30,12 @@
#include <string.h>
#include <assert.h>
+#if SIZE_MAX == UINT32_MAX
+# define c_zu PRIu32
+#elif SIZE_MAX == UINT64_MAX
+# define c_zu PRIu64
+#endif
+
#if defined(_MSC_VER)
# pragma warning(disable: 4116 4996) // unnamed type definition in parentheses
# define STC_FORCE_INLINE static __forceinline