help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Type punned-pointers


From: Ulrich Lauther
Subject: Re: Type punned-pointers
Date: Mon, 12 Jun 2006 10:31:28 +0000 (UTC)

Henrik Goldman <henrik_goldman@mail.tele.dk> wrote:

: > FD_SET is probably a macro. I would take a look at the expanded code, 
: > which
: > might try to do some illegal pointer assignment.
: >

: Yes, I've been thinking the same thing. Here is a piece of header from 
: /usr/include/sys/_fd_macros.h:


the problem will possibly vanish if you disable strict-aliasing.

>From the manual:

`-fstrict-aliasing'
  Allows the compiler to assume the strictest aliasing rules
  applicable to the language being compiled.  For C (and C++), this
  activates optimizations based on the type of expressions.  In
  particular, an object of one type is assumed never to
  reside at the same address as an object of a different type, unless the
  types are almost the same.  For example, an `unsigned int' can
  alias an `int', but not a `void*' or a `double'.  A character type
  may alias any other type.

        -lauther

[nosave]
----------------------------------------------------------------------------
Ulrich Lauther          ph: +49 89 636 48834 fx: ... 636 42284
Siemens CT SE 6         Internet: Ulrich.Lauther@siemens.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]