- - Mimic the built-in types. This can simplify use and eliminate logic
- errors since there is no need to reason about the current endianness of
- variables.
+ - A need to simplify program logic and eliminate logic
+ errors. Since the endian types mimic the built-in types, there is no need to reason about the current endianness of variables
+ and that can simplify program logic and eliminate logic errors.
- - 1, 2, 3, 4, 5, 6, 7, and 8 byte integers are supported. Use of 3, 5,
- 6, or 7 byte integers can reduce internal and external space usage and
+
- A need to use unusual integer sizes (i.e. 3, 5,
+ 6, or 7 bytes) to reduce internal and external space usage and
save I/O time.
- - Alignment is not required. This can eliminate padding bytes in
+
- A need to use unaligned variables. Endian types can eliminate padding bytes in
structures, reducing internal and external space usage and saving I/O
- time.
+ time. They can deals with structures defined like this:
+
+ struct S {
+ uint16_t a;
+ uint32_t b;
+ } __attribute__ ((packed));
+
|
- - Already familiar to developers who have been using C conversion
+
- A need to leverage knowledge of developers who have been using C byte
+ swapping
functions for years.
- - Uses less CPU time, particularly if each variable is used many times
- relative to I/O of the variable.
+ - A need to save CPU time when a variable is used many times
+ relative to its I/O.
- - Easier to pass structures to third-party libraries expecting a
+
- A need to pass structures to third-party libraries expecting a
specific structure format.
- - Supports
float and double .
|
diff --git a/example/endian_example.cpp b/example/endian_example.cpp
index ec8a0e3..674a5ef 100644
--- a/example/endian_example.cpp
+++ b/example/endian_example.cpp
@@ -10,6 +10,7 @@
//----------------------------------------------------------------------------//
#define _CRT_SECURE_NO_DEPRECATE // quiet VC++ 8.0 foolishness
+#define _SCL_SECURE_NO_WARNINGS
#include