From 233cb530fccabad61e5d374ff395a80b4f433938 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 26 Jul 2013 01:30:01 +0200 Subject: [PATCH] read(int socket): type aliasing compliance --- src/remote.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/remote.cc b/src/remote.cc index 3e0f8a56..5776d624 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -132,9 +132,13 @@ void read(int socket, char* buffer, size_t size) template T read(int socket) { - char value[sizeof(T)]; + union + { + T object; + char value[sizeof(T)]; + }; read(socket, value, sizeof(T)); - return *(T*)(value); + return object; } template<>