Hello guys,

I just wanted to drop a little note that I've finally been successful in
building the core GNUstep components with clang (there have been some
linkage problems with libobjc2, which Richard fixed last night). Only
-gui needed a little nudging (apparently, clang is very specific about
not wanting unions with variable-sized members -- patch attached). The
combination still seems to be rough on the edges (crashes here and
there, odd effects in gdb) , but the more adventurous can surely try it
out without being totally frustated.

Cheers,


Niels
Index: Source/NSColor.m
===================================================================
--- Source/NSColor.m	(revision 29361)
+++ Source/NSColor.m	(working copy)
@@ -1265,17 +1265,14 @@
 - (NSUInteger) hash
 {
   int nums = [self numberOfComponents];
-  union {
-    uint8_t	bytes[sizeof(float) * nums];
-    float	floats[nums];
-  } u;
+  float floats[nums];
   NSUInteger	h = 0;
   unsigned	i;
 
-  [self getComponents: u.floats];
-  for (i = 0; i < sizeof(u); i++)
+  [self getComponents: &floats[0]];
+  for (i = 0; i < sizeof(floats); i++)
     {
-      h = (h << 5) + h + u.bytes[i];
+      h = (h << 5) + h + *(uint8_t*)(((uintptr_t)&floats[0])+(i*sizeof(uint8_t)));
     }
   return h;
 }

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to