This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aliasing nastiness
- To: Matt Carlson <mindbender at lokigames dot com>
- Subject: Re: aliasing nastiness
- From: Geoff Keating <geoffk at envy dot cygnus dot com>
- Date: 14 Jan 2000 21:48:06 -0800
- CC: gcc at gcc dot gnu dot org
- References: <387F78A7.E3B0BFFB@lokigames.com>
Matt Carlson <mindbender@lokigames.com> writes:
> Hello,
>
> I'm having a problem reading a double value from a character buffer.
> Apparently the value stored in tmp (see below) differs between linux
> and Win9x. I am aware of the fact that this is violating the ISO C
> aliasing
> assumptions and have compiled my project with the -fno-strict-aliasing
> flag. My question is : is there any way to make the value that gets
> stored into tmp identical across both platforms?
>
> double FillDouble( char * buffer )
> {
> double tmp = *(double*)buffer;
>
> return tmp;
> }
This doesn't violate the aliasing rules, because 'char *' aliases everything.
I suspect you have some other problem, like \r\n -> \n conversion.
--
- Geoffrey Keating <geoffk@cygnus.com>