diff options
| author | Phil Nash | 2014-01-07 17:43:18 +0000 |
|---|---|---|
| committer | Phil Nash | 2014-01-07 17:43:18 +0000 |
| commit | 46a1fc76159df9e19ead8bac6299fafceab65a13 (patch) | |
| tree | 3181d1295b2a244b01c454d946e8b88de0f6f9bc /include | |
| parent | be890d0c154099f83715e49f1ff331d097b56bde (diff) | |
| download | catch3-46a1fc76159df9e19ead8bac6299fafceab65a13.tar.gz | |
Removed unnecessary union name
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_tostring.hpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index b463e4ff..c081e944 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -83,17 +83,16 @@ namespace Detail { // Does not consider endian-ness template<typename T> std::string rawMemoryToString( T value ) { - union - { - T value; + union { + T typedValue; unsigned char bytes[sizeof(T)]; - } valueAsBuffer; + }; - valueAsBuffer.value = value; + typedValue = value; std::ostringstream oss; oss << "0x"; - for( unsigned char* cp = valueAsBuffer.bytes; cp < valueAsBuffer.bytes+sizeof(T); ++cp ) + for( unsigned char* cp = bytes; cp < bytes+sizeof(T); ++cp ) oss << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)*cp; return oss.str(); } |