Fully transitive const is not necessary
Leandro Lucarella
llucax at gmail.com
Thu Apr 3 07:51:34 PDT 2008
Walter Bright, el 2 de abril a las 15:22 me escribiste:
> Janice Caron wrote:
> >However, I suspect that the following will be OK.
> > enum g = 42;
> > pure int f()
> > {
> > return g;
> > }
>
> Yes, because the value of g can never change.
>
> The way to think about pure functions is that if the arguments are the same, the result
> will be the same. This precludes reading any global state that could change, and precludes
> writing to any global state.
And using most of the IO functions, like read/write.
pure byte f()
{
byte b;
read(0, &b, 1);
return b;
}
Can't be a pure function.
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Dentro de 30 años Argentina va a ser un gran supermercado con 15
changuitos, porque esa va a ser la cantidad de gente que va a poder
comprar algo.
-- Sidharta Wiki
More information about the Digitalmars-d
mailing list