Re: ref is pointer sugar?

2010-08-06 Thread Pluto
== Quote from Jacob Carlborg (d...@me.com)'s article > On 2010-08-06 15:33, Pluto wrote: > > == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > >> On Fri, 06 Aug 2010 08:51:31 -0400, Pluto wrote: > >>> Are these equivalent? > >&g

Re: ref is pointer sugar?

2010-08-06 Thread Pluto
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Fri, 06 Aug 2010 08:51:31 -0400, Pluto wrote: > > Are these equivalent? > > > > S s;//struct > > > > void f(ref S s){s.x++;} > > f(s); > > > > void f2(S* s){(*s).x++;}

Re: ref is pointer sugar?

2010-08-06 Thread Pluto
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Fri, 06 Aug 2010 08:51:31 -0400, Pluto wrote: > > Are these equivalent? > > > > S s;//struct > > > > void f(ref S s){s.x++;} > > f(s); > > > > void f2(S* s){(*s).x++;}

ref is pointer sugar?

2010-08-06 Thread Pluto
Are these equivalent? S s;//struct void f(ref S s){s.x++;} f(s); void f2(S* s){(*s).x++;} f2(&s); If so, why is it stated that ref is very rarely used? It looks like something I would use a lot with structures.

Re: Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-08-01 Thread Pluto
es toInt and then does toFloat in the catch. Not sure whether it was just bad code (looks like it though) but there are probably some examples where people really don't know what kind of data they are handling and use std.conv to try. Not really sure about that now that I think about it. ~~ :Pluto

Re: Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-08-01 Thread Pluto
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > Pluto wrote: > > == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > >> Pluto wrote: > >> > This part has always bothered me. Could somebody please explain to me > >>

Re: Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-07-31 Thread Pluto
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > Pluto wrote: > > This part has always bothered me. Could somebody please explain to me the > > rationale behind limiting functions to one usable error code? > Well, traditionally it was done because testing

Re: Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-07-31 Thread Pluto
== Quote from Dmitry Olshansky (dmitry.o...@gmail.com)'s article > On 31.07.2010 23:44, Pluto wrote: > > This part has always bothered me. Could somebody please explain to me the > > rationale behind limiting functions to one usable error code? > > > > if(function(

Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-07-31 Thread Pluto
This part has always bothered me. Could somebody please explain to me the rationale behind limiting functions to one usable error code? if(function()) ~~ :Pluto