Re: Strict aliasing in D

2013-08-03 Thread David Nadlinger
On Monday, 29 July 2013 at 05:05:54 UTC, Denis Shelomovskij wrote: So is enhancement request filed? Now it is: http://d.puremagic.com/issues/show_bug.cgi?id=10750 Sorry, I'm not following the lists closely right now due to university work. David

Re: Strict aliasing in D

2013-08-03 Thread monarch_dodra
On Saturday, 3 August 2013 at 11:39:44 UTC, David Nadlinger wrote: On Monday, 29 July 2013 at 05:05:54 UTC, Denis Shelomovskij wrote: So is enhancement request filed? Now it is: http://d.puremagic.com/issues/show_bug.cgi?id=10750 Sorry, I'm not following the lists closely right now due to

Re: Strict aliasing in D

2013-07-28 Thread deadalnix
On Saturday, 27 July 2013 at 09:03:57 UTC, monarch_dodra wrote: On Saturday, 27 July 2013 at 08:58:22 UTC, Walter Bright wrote: On 7/27/2013 1:08 AM, monarch_dodra wrote: 1. Does strict aliasing apply to slices? I don't know what you mean. double d; uint* p = cast(int*)d; //unsafe aliasing

Re: Strict aliasing in D

2013-07-28 Thread Denis Shelomovskij
27.07.2013 12:59, Walter Bright пишет: On 7/27/2013 1:57 AM, David Nadlinger wrote: On Saturday, 27 July 2013 at 06:58:04 UTC, Walter Bright wrote: Although it isn't in the spec, D should be strict aliasing. This is because: 1. it enables better code generation 2. there are ways

Re: Strict aliasing in D

2013-07-27 Thread Walter Bright
. Resurrecting this old thread, maybe we'll get a better answer this time. I too am interested in knowing how D deals with pointer aliasing. I'd like a bit more of an official or factual answer. Although it isn't in the spec, D should be strict aliasing. This is because: 1. it enables better code

Re: Strict aliasing in D

2013-07-27 Thread monarch_dodra
should be strict aliasing. This is because: 1. it enables better code generation 2. there are ways, such as unions, to get the other aliasing that doesn't break strict aliasing Thank you for the answer. I expected D to do strict aliasing for the reasons you mentioned. This does come up

Re: Strict aliasing in D

2013-07-27 Thread deadalnix
On Saturday, 27 July 2013 at 08:08:01 UTC, monarch_dodra wrote: Thank you for the answer. I expected D to do strict aliasing for the reasons you mentioned. This does come up with two follow up question though: 1. Does strict aliasing apply to slices? 2. C++ uses 'char' as a 'neutral' type

Re: Strict aliasing in D

2013-07-27 Thread David Nadlinger
On Saturday, 27 July 2013 at 06:58:04 UTC, Walter Bright wrote: Although it isn't in the spec, D should be strict aliasing. This is because: 1. it enables better code generation 2. there are ways, such as unions, to get the other aliasing that doesn't break strict aliasing We need

Re: Strict aliasing in D

2013-07-27 Thread Walter Bright
On 7/27/2013 1:08 AM, monarch_dodra wrote: 1. Does strict aliasing apply to slices? I don't know what you mean. 2. C++ uses 'char' as a 'neutral' type that can alias to anything. What about D? Does char fill that role? Does ubyte? I'll go with deadalnix's answer.

Re: Strict aliasing in D

2013-07-27 Thread monarch_dodra
On Saturday, 27 July 2013 at 08:35:36 UTC, deadalnix wrote: On Saturday, 27 July 2013 at 08:08:01 UTC, monarch_dodra wrote: Thank you for the answer. I expected D to do strict aliasing for the reasons you mentioned. This does come up with two follow up question though: 1. Does strict

Re: Strict aliasing in D

2013-07-27 Thread Walter Bright
On 7/27/2013 1:57 AM, David Nadlinger wrote: On Saturday, 27 July 2013 at 06:58:04 UTC, Walter Bright wrote: Although it isn't in the spec, D should be strict aliasing. This is because: 1. it enables better code generation 2. there are ways, such as unions, to get the other aliasing

Re: Strict aliasing in D

2013-07-27 Thread monarch_dodra
On Saturday, 27 July 2013 at 08:58:22 UTC, Walter Bright wrote: On 7/27/2013 1:08 AM, monarch_dodra wrote: 1. Does strict aliasing apply to slices? I don't know what you mean. double d; uint* p = cast(int*)d; //unsafe aliasing vs double[] d = new double[](1); uint[] p = cast(uint[])d;

Re: Strict aliasing in D

2013-07-27 Thread ponce
On Saturday, 27 July 2013 at 06:58:04 UTC, Walter Bright wrote: 2. there are ways, such as unions, to get the other aliasing that doesn't break strict aliasing It would be great to have something like GCC's solution: warn when pointer casts may violate the strict aliasing rule, and provide a

Re: Strict aliasing in D

2013-07-27 Thread ponce
On Saturday, 27 July 2013 at 09:05:32 UTC, ponce wrote: It would be great to have something like GCC's solution: warn when pointer casts may violate the strict aliasing rule, and provide a flag to disable it. BTW, C++ compilers usually have an effective way to disambiguate pointer aliasing

Re: Strict aliasing in D

2013-07-27 Thread bearophile
Walter Bright: Although it isn't in the spec, D should be strict aliasing. This is because: 1. it enables better code generation 2. there are ways, such as unions, to get the other aliasing that doesn't break strict aliasing Is it good to add to Phobos a small template (named like

Re: Strict aliasing in D

2013-07-26 Thread monarch_dodra
On Sunday, 29 January 2012 at 16:25:33 UTC, Peter Alexander wrote: As for D, I can't see anything in the standard that prevents two pointers of different types from pointing to the same location, but I suspect it is an assumption that is being made. Resurrecting this old thread, maybe we'll

Strict aliasing in D

2012-01-29 Thread Denis Shelomovskij
It was originally posted to D.learn but there was no reply. So: Is there a strict aliasing rule in D? I just saw https://bitbucket.org/goshawk/gdc/changeset/b44331053062

Re: Strict aliasing in D

2012-01-29 Thread Daniel Murphy
Denis Shelomovskij verylonglogin@gmail.com wrote in message news:jg3f21$1jqa$1...@digitalmars.com... It was originally posted to D.learn but there was no reply. So: Is there a strict aliasing rule in D? I just saw https://bitbucket.org/goshawk/gdc/changeset/b44331053062 Struct aliasing

Re: Strict aliasing in D

2012-01-29 Thread Peter Alexander
On Sunday, 29 January 2012 at 14:05:25 UTC, Daniel Murphy wrote: Denis Shelomovskij verylonglogin@gmail.com wrote in message news:jg3f21$1jqa$1...@digitalmars.com... It was originally posted to D.learn but there was no reply. So: Is there a strict aliasing rule in D? I just saw https

Re: Strict aliasing in D

2012-01-29 Thread Daniel Murphy
Peter Alexander peter.alexander...@gmail.com wrote in message news:ggzqksxaiccnkvztm...@dfeed.kimsufi.thecybershadow.net... That's not strict aliasing, that's just a language rule about aliasing for vector ops. Yeah, you're right. It's just an aliasing rule.

Strict aliasing in D

2012-01-20 Thread Denis Shelomovskij
Is there a strict aliasing rule in D? I just saw https://bitbucket.org/goshawk/gdc/changeset/b44331053062