On 04/10/13 12:20, Rolf Eike Beer wrote:
> Just some thoughts:
> -some compilers may error out because you dereference an uninitialized 
> pointer
> -some compilers may complain because you perform an operation that does 
> nothing, maybe prepend it with a (void) to mark that as intentional

This is the test that is currently executed, I just added some tests...


> What about this:
> 
>       struct struct_with_member tmp, *tmpp;
>       tmp.foo = 0;
>       tmpp = &tmp;
>       return tmpp->foo;

I saw at leas one case where CheckStructHasMember is used to check if a
struct has a method, so "foo()" instead of "foo"...
With such a change "tmp.foo() = 0" will fail, so it looks like a non
compatible change to me.
Also this requires that the struct has a public constructor.

If you are not against it, I would also like to change "int main()" to
"int main(int argc, char **argv)" because I found a library (ACE [1])
that causes the test to fail on windows due to some weird define (see [2])

[1]http://www.cs.wustl.edu/~schmidt/ACE.html
[2]http://doxygen.theaceorb.nl/libace-doc/a01553_source.html


So what about something like this?

   int main(int argc, char **argv)
   {
      (void)(argc); // To avoid warnings for unused parameters
      (void)(argv);
      struct struct_with_member *tmp = 0;
      void *tmpv = (void*)&(tmp->foo);
      (void)(tmpv);
      return tmpv;
   }


Cheers,
 Daniele
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to