On Wed, 07 Mar 2012 19:06:14 -0500, Timon Gehr <timon.g...@gmx.ch> wrote:

On 03/07/2012 11:37 PM, Stewart Gordon wrote:
On 07/03/2012 15:41, Steven Schveighoffer wrote:
<snip>
In fact, I think this is valid D code:

int i;
const int *pi = &i;
int *p = cast()pi;
*p = 5; // legal because I know this points at i, and i is really mutable

cast() is an abomination. I'm not sure OTTOMH whether it's a bug that it
works.


It is not legal code. I did not point it out because it was clear what was meant. cast() only casts away the top level of modifiers. It is perfectly safe except for class objects.

If it's not legal code, then how is implicitly casting away inout during function execution legal code? Isn't this the same thing?

-Steve

Reply via email to