summaryrefslogtreecommitdiff
path: root/includes/BString.h
diff options
context:
space:
mode:
authorNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-20 00:07:48 -0800
committerNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-20 00:07:48 -0800
commitfd77a467478938e0b0fd7b821d516a83827a3a61 (patch)
tree62683896f28e131eaec9597c3617cc7157ead227 /includes/BString.h
parent8a37c7ce67e049feafc981e6386477497102ac93 (diff)
Slightly better printf formats for 32 and 64 bits values.
Diffstat (limited to 'includes/BString.h')
-rw-r--r--includes/BString.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/BString.h b/includes/BString.h
index 09e0d40..f8f9710 100644
--- a/includes/BString.h
+++ b/includes/BString.h
@@ -1,5 +1,7 @@
#pragma once
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
#include <stdarg.h>
#include <string.h>
#include <stdint.h>
@@ -20,10 +22,10 @@ class String : private std::string {
String(const char (&str)[L]) : std::string(str, L - 1) { }
String(const char * str, size_t n) : std::string(str ? str : "", str ? n : 0) { }
String(char c) { set("%c", c); }
- String(int32_t i) { set("%i", i); }
- String(uint32_t i) { set("%u", i); }
- String(int64_t i) { set("%lli", i); }
- String(uint64_t i) { set("%llu", i); }
+ String(int32_t i) { set("%" PRIi32, i); }
+ String(uint32_t i) { set("%" PRIu32, i); }
+ String(int64_t i) { set("%" PRIi64, i); }
+ String(uint64_t i) { set("%" PRIu64, i); }
String(double d) { set("%g", d); }
String(const String & s) : std::string(s) { }
String(const std::string & s) : std::string(s) { }