A few more strict aliasing warnings
-----------------------------------

                 Key: AMQCPP-42
                 URL: https://issues.apache.org/activemq/browse/AMQCPP-42
             Project: ActiveMQ C++ Client
          Issue Type: Bug
    Affects Versions: 1.1
            Reporter: Albert Strasheim
         Assigned To: Nathan Mittler
            Priority: Critical
             Fix For: 1.1


Brought over from AMQCPP-25.

We might consider using -Wstrict-aliasing=2. Warns in more cases, with some 
chance of false positives.

I still get the following warnings with GCC 4.1.1 on FC6 with revision 495335:

{noformat}
activemq/network/ServerSocket.cpp: In member function 'virtual void 
activemq::network::ServerSocket::bind(const char*, int, int)':
activemq/network/ServerSocket.cpp:162: warning: dereferencing type-punned 
pointer might break strict-aliasing rules
activemq/network/ServerSocket.cpp: In member function 'virtual 
activemq::network::Socket* activemq::network::ServerSocket::accept()':
activemq/network/ServerSocket.cpp:208: warning: dereferencing type-punned 
pointer might break strict-aliasing rules
activemq/io/DataInputStreamTest.h:85: warning: dereferencing type-punned 
pointer will break strict-aliasing rules
activemq/io/DataInputStreamTest.h:86: warning: dereferencing type-punned 
pointer will break strict-aliasing rules
{noformat}

I noticed you used a memcpys to fix this issue. Did you consider trying a 
union? Without knowing for certain (maybe we'll do some benchmarks tomorrow), a 
union might be faster than a call to memcpy.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to