Re: Implicit conversion rules

2015-10-22 Thread Sigg via Digitalmars-d-learn
On Wednesday, 21 October 2015 at 22:49:16 UTC, Marco Leise wrote: God forbid anyone implement such nonsense into D ! That would be the last thing we need Slight nitpick, but what I suggested for our hypothetical situation was only to apply for auto, once variable was assigned to auto and go

Re: Implicit conversion rules

2015-10-21 Thread Maxim Fomin via Digitalmars-d-learn
On Wednesday, 21 October 2015 at 19:49:35 UTC, Ali Çehreli wrote: On 10/21/2015 12:37 PM, Sigg wrote: > cause at least few more "fun" side effects. One of those side effects would be function calls binding silently to another overload: void foo(bool){/* ... */} void foo(int) {/* ... */} a

Re: Implicit conversion rules

2015-10-21 Thread Maxim Fomin via Digitalmars-d-learn
On Wednesday, 21 October 2015 at 22:49:16 UTC, Marco Leise wrote: Am Wed, 21 Oct 2015 12:49:35 -0700 schrieb Ali Çehreli : On 10/21/2015 12:37 PM, Sigg wrote: > cause at least few more "fun" side effects. One of those side effects would be function calls binding silently to another overload

Re: Implicit conversion rules

2015-10-21 Thread Marco Leise via Digitalmars-d-learn
Am Wed, 21 Oct 2015 12:49:35 -0700 schrieb Ali Çehreli : > On 10/21/2015 12:37 PM, Sigg wrote: > > > cause at least few more "fun" side effects. > > One of those side effects would be function calls binding silently to > another overload: > > void foo(bool){/* ... */} > void foo(int) {/* ...

Re: Implicit conversion rules

2015-10-21 Thread Ali Çehreli via Digitalmars-d-learn
On 10/21/2015 12:37 PM, Sigg wrote: > cause at least few more "fun" side effects. One of those side effects would be function calls binding silently to another overload: void foo(bool){/* ... */} void foo(int) {/* ... */} auto a = 0; // If the type were deduced by the value, foo(a);

Re: Implicit conversion rules

2015-10-21 Thread Sigg via Digitalmars-d-learn
On Wednesday, 21 October 2015 at 19:07:24 UTC, anonymous wrote: The problem is of course that int and ulong have no common super type, at least not in the primitive integer types. int supports negative values, ulong supports values greater than long.max. Yes, I'm well aware of that. I was un

Re: Implicit conversion rules

2015-10-21 Thread anonymous via Digitalmars-d-learn
On Wednesday, October 21, 2015 07:53 PM, Sigg wrote: > void func() { > int a = -10; > ulong b = 0; > ulong c = a + b; > writefln("%s", c); > } > > out: 18446744073709551574 > > But shouldn't declaring c as auto force compiler to go extra step >