[Issue 3748] inout does not work properly
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Aug 31 12:11:27 PDT 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=3748
--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-08-31 12:11:15 PDT ---
it is not debateable.  The issue is, when inside an inout-enabled function, all
inout variables are *assignable* from other inout variables.
So for example, if you have:
inout(int) * globalvar;
inout(int)* foo(inout(int)* x)
{
   return globalvar;
}
void main()
{
   int x;
   auto y = foo(&x);
}
what type is y?  inout(T) is changed to just T in this scenario, since the
constancy factor is mutable, so essentially, you now have a mutable pointer to
what is treated as const as you say.
The type system *must* prevent non-local variables (i.e. variables not on the
stack) from being inout.  Otherwise, you cannot make guarantees about inout.
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list