March 03, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Mar 3, 2013 9:41 PM, "Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> wrote: > > On 3/3/13 9:42 AM, Manu wrote: >> >> GCC has min and max operators, and the syntax is very clever: >> min = a <? b; >> max = a >? b; >> Ie, a shorthand of the ?: operator, in a similar way that C# has '??' >> (another really nice shorthand). > > > Gone. http://gcc.gnu.org/onlinedocs/gcc/Deprecated-Features.html > > Andrei > > And good riddance too. Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; |
March 03, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Sunday, 3 March 2013 at 22:58:02 UTC, bearophile wrote:
> Andrei Alexandrescu:
>
>> Gone. http://gcc.gnu.org/onlinedocs/gcc/Deprecated-Features.html
>
> Do you know why?
Probably because they were non-standard, but don't look non-standard. It's not fun finding them in code that you want to compile with a different compiler...
|
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| Nooooooo! Why would they! ;) Well I still think they're a great shorthand. On 4 March 2013 07:38, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org>wrote: > On 3/3/13 9:42 AM, Manu wrote: > >> GCC has min and max operators, and the syntax is very clever: >> min = a <? b; >> max = a >? b; >> Ie, a shorthand of the ?: operator, in a similar way that C# has '??' >> (another really nice shorthand). >> > > Gone. http://gcc.gnu.org/onlinedocs/**gcc/Deprecated-Features.html<http://gcc.gnu.org/onlinedocs/gcc/Deprecated-Features.html> > > Andrei > > > |
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Sunday, 3 March 2013 at 21:38:44 UTC, Andrei Alexandrescu wrote:
> On 3/3/13 9:42 AM, Manu wrote:
>> GCC has min and max operators, and the syntax is very clever:
>> min = a <? b;
>> max = a >? b;
>> Ie, a shorthand of the ?: operator, in a similar way that C# has '??'
>> (another really nice shorthand).
>
> Gone. http://gcc.gnu.org/onlinedocs/gcc/Deprecated-Features.html
>
> Andrei
I see nothing about the ?:, and it is indeed useful (or the ?? in C#, that has the same purpose).
|
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | Am Fri, 1 Mar 2013 16:36:07 -0800 schrieb "H. S. Teoh" <hsteoh@quickfur.ath.cx>: > +1. With D's compile-time capabilities, DSLs give you arbitrarily complex custom syntax at essentially zero runtime cost. You can even implement compile-time DSL optimizers that produce optimized code like no overloaded operator ever can. > > > T Oh my fucking god. That means you can generate complex matrix-vector interactions "on the spot" without ever using temporary matrices or vectors and the inevitable cost of leaving the FPU and rounding to float! That's brilliant. -- Marco |
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | > Oh my fucking god. That means you can generate complex
> matrix-vector interactions "on the spot" without ever using
> temporary matrices or vectors and the inevitable cost of
> leaving the FPU and rounding to float! That's brilliant.
You can also do this using expression templates, and there are C++ libraries that do this. Of course, expression templates should also be much easier to implement in D than they are in C++.
|
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to jerro | jerro:
> Of course, expression templates should also be much easier
> to implement in D than they are in C++.
I don't remember seeing them implemented in D, so far.
Bye,
bearophile
|
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | Am Mon, 04 Mar 2013 23:36:29 +0100 schrieb "bearophile" <bearophileHUGS@lycos.com>: > jerro: > > > Of course, expression templates should also be much easier to implement in D than they are in C++. > > I don't remember seeing them implemented in D, so far. > > Bye, > bearophile It's not as easy to do without C++'s convoluted constructor lookup rules. The clean approach of D makes it impossible to call a constructor implicitly like they do on the Wikipedia page about expression templates. But the approach with a small DSL looks ok, too. Not quite as seamless as the C++ version though. -- Marco |
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | On Tue, Mar 05, 2013 at 12:17:06AM +0100, Marco Leise wrote: > Am Mon, 04 Mar 2013 23:36:29 +0100 > schrieb "bearophile" <bearophileHUGS@lycos.com>: > > > jerro: > > > > > Of course, expression templates should also be much easier to implement in D than they are in C++. > > > > I don't remember seeing them implemented in D, so far. > > > > Bye, > > bearophile > > It's not as easy to do without C++'s convoluted constructor > lookup rules. The clean approach of D makes it impossible to > call a constructor implicitly like they do on the Wikipedia > page about expression templates. > But the approach with a small DSL looks ok, too. Not quite as > seamless as the C++ version though. [...] The advantage of using DSLs is that you are free of syntax constraints in the hosting language. For example, you can add different symbols for dot product, cross product, transpose operator, etc., without being restricted by the operators that D allows you to overload. D's mixins allow you to transform such expressions into D code in non-trivial ways to achieve maximum performance in spite of the ease of writing it. T -- Shin: (n.) A device for finding furniture in the dark. |
March 04, 2013 Re: Additional Binary Operators | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | On Monday, 4 March 2013 at 21:58:34 UTC, Marco Leise wrote: > Am Fri, 1 Mar 2013 16:36:07 -0800 > schrieb "H. S. Teoh" <hsteoh@quickfur.ath.cx>: > >> +1. With D's compile-time capabilities, DSLs give you arbitrarily >> complex custom syntax at essentially zero runtime cost. You can even >> implement compile-time DSL optimizers that produce optimized code like >> no overloaded operator ever can. >> >> >> T > > Oh my fucking god. That means you can generate complex > matrix-vector interactions "on the spot" without ever using > temporary matrices or vectors and the inevitable cost of > leaving the FPU and rounding to float! That's brilliant. It's slightly amusing you keep re-inventing Nimrod, albeit poorly: http://build.nimrod-code.org/docs/manual.html#term-rewriting-macros |
Copyright © 1999-2021 by the D Language Foundation