Disallow arrays as pointers
    bearophile 
    bearophileHUGS at lycos.com
       
    Tue Nov  1 17:57:33 PDT 2011
    
    
  
> So I think this should compile:
> 
> char[] foo(string s1, string s2) pure {
>     return s1 ~ s2;
> }
> void main() {}
The situation is a bit more complex:
char[] foo(immutable string s1, immutable string s2) pure {
    return s1 ~ s2;
}
void main() {
    string t1 = "foo";
    string t2 = "bar";
    auto t3 = t1 ~ t2;
    static assert(is(typeof(t3) == string));
}
So there I was asking for the druntime array concat to return something immutable that is implicitly cast-able to mutable. It's kind of the opposite of the recently introduced rule for strongly pure functions... So I don't know if this is possible.
> And regarding toStringz(), this modified version seems to work as desired:
http://d.puremagic.com/issues/show_bug.cgi?id=6878
Bye,
bearophile
    
    
More information about the Digitalmars-d
mailing list