473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

type-punned pointers!?

Hi,

I'm seeing a weird problem on hp-ux (ia64) using g++ 4.1.1.

Here below is a tiny bit of code which sets up the nessecary code for doing
a select():

fd_set fdread, fdwrite;

FD_ZERO(&fdread);

FD_ZERO(&fdwrite);

FD_SET(m_IncomingSocket.GetSocket(), &fdread);

FD_SET(m_IncomingSocket.GetSocket(), &fdwrite);

For the last two lines I get the following warning:

warning: dereferencing type-punned pointer will break strict-aliasing rules
warning: dereferencing type-punned pointer will break strict-aliasing rules

I don't really understand why 'clean' code would give such a warning since
it's structures which are defined by the system.
However perhaps someone could tell me what it actually means and eventually
how to solve it? My g++ optimization is O2.

Thanks in advance.
-- Henrik
Jun 7 '06 #1
1 2246
Henrik Goldman wrote:
I'm seeing a weird problem on hp-ux (ia64) using g++ 4.1.1.
Have you tried news:gnu.g++.help ? If not, why not? If you have, what
did you find out?
Here below is a tiny bit of code which sets up the nessecary code for
doing a select():

fd_set fdread, fdwrite;
Are we supposed to know what 'fd_set' is?
FD_ZERO(&fdread);

FD_ZERO(&fdwrite);

FD_SET(m_IncomingSocket.GetSocket(), &fdread);

FD_SET(m_IncomingSocket.GetSocket(), &fdwrite);
Those 'FD_' things look like macros. How are they defined?
For the last two lines I get the following warning:

warning: dereferencing type-punned pointer will break strict-aliasing
rules warning: dereferencing type-punned pointer will break
strict-aliasing rules
I don't really understand why 'clean' code
What makes you believe the code is "'clean'"? What does it mean,
exactly?
would give such a warning
since it's structures which are defined by the system.
However perhaps someone could tell me what it actually means and
eventually how to solve it? My g++ optimization is O2.


If you haven't tried news:gnu.g++.help yet, go try it. Also, they
have an online forum (on their web site), IIRC. Don't discount it.
It's much more suitable for questions on a particular compiler's
behaviour than c.l.c++.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
3
by: dgaucher | last post by:
Hi, I want to consume a Web Service that returns a choice, but my C++ client always receives the same returned type. On the other hand, when I am using a Java client, it is working fine (of...
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
3
by: john | last post by:
Hi to All To demonstrate: public class MyBaseGenericClass<T> { } public class MyGenericClass1<T: MyBaseGenericClass<T> {
9
by: weirdwoolly | last post by:
Hopefully someone will be able to help. I have written a stored procedure in C++ called from a Java test harness to validate the graphic data types in C++ and their use. I have declared the...
5
by: JH | last post by:
Hi I found that a type/class are both a subclass and a instance of base type "object". It conflicts to my understanding that: 1.) a type/class object is created from class statement 2.) a...
3
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.