Johannes Hofmann
2013-01-14 20:57:46 UTC
Hi,
line 135 in lout object.cc:
return ((int*)&value)[0] ^ ((int*)&value)[1];
causes the following error on 64bit systems for me:
warning: dereferencing type-punned pointer will
break strict-aliasing rules
Can we replace it like this:
diff -r dd6f2d1eb15a lout/object.cc
--- a/lout/object.cc Mon Jan 14 10:26:37 2013 -0300
+++ b/lout/object.cc Mon Jan 14 21:56:46 2013 +0100
@@ -21,6 +21,7 @@
#include "object.hh"
#include <stdio.h>
+#include <stdint.h>
#include <config.h>
namespace lout {
@@ -132,7 +133,7 @@
// Combine both parts of the pointer value *itself*, not what it
// points to, by first referencing it (operator "&"), then
// dereferencing it again (operator "[]").
- return ((int*)&value)[0] ^ ((int*)&value)[1];
+ return ((intptr_t)value >> 32) ^ ((intptr_t)value);
#endif
}
Cheers,
Johannes
line 135 in lout object.cc:
return ((int*)&value)[0] ^ ((int*)&value)[1];
causes the following error on 64bit systems for me:
warning: dereferencing type-punned pointer will
break strict-aliasing rules
Can we replace it like this:
diff -r dd6f2d1eb15a lout/object.cc
--- a/lout/object.cc Mon Jan 14 10:26:37 2013 -0300
+++ b/lout/object.cc Mon Jan 14 21:56:46 2013 +0100
@@ -21,6 +21,7 @@
#include "object.hh"
#include <stdio.h>
+#include <stdint.h>
#include <config.h>
namespace lout {
@@ -132,7 +133,7 @@
// Combine both parts of the pointer value *itself*, not what it
// points to, by first referencing it (operator "&"), then
// dereferencing it again (operator "[]").
- return ((int*)&value)[0] ^ ((int*)&value)[1];
+ return ((intptr_t)value >> 32) ^ ((intptr_t)value);
#endif
}
Cheers,
Johannes