On Thu, Oct 01, 2009 at 05:29:45PM -0700, Smith, Stan wrote: > Do the Sun guys use gcc?
gcc is commonly available on Solaris and it would be a pretty pointless waste of time to compile opensm with sun studio :) > > #define cl_item_obj(item_ptr, obj_ptr, item_field) (typeof(obj_ptr)) \ > > (void *)((uint8_t*)item_ptr - ((uintptr_t)(&(obj_ptr)->item_field) - > > ((uintptr_t)&(obj_ptr)))) > > #endif > > Interesting, worth a try. > > > > > And rely on the C implicit cast from void* to an object type, and rely > > on compiles with gcc to do the extra type checking. > > 'compiles with gcc' ? The use of typeof in cl_item_obj (and typically container_of too) is just a correctness checking feature. struct bar *foo = cl_item_obj(..); Does not compile if 'struct bar' is the wrong type, deduced automatically from the arguments. By changing it to not use typeof the runtime functionality is the same but you loose the static checking. This is a poor mans way to implement C++ templates :) So 'relying on compiles with gcc' means you rely on builds with gcc to do the check and detect incorrect code. Since VS C cannot implement typeof it cannot provide the check, so lets just toss out the functionality. No big deal. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
