On Thursday, 11 October 2018 at 23:17:15 UTC, Jonathan Marler
wrote:
For example, the "Conditional operator" in D actually has a
higher priority than an assignment, but in C++ it's the same
and is evaluated right-to-left. So this expression would be
different in C++ and D:
a ? b : c = d
In
On Friday, 12 October 2018 at 13:15:22 UTC, Steven Schveighoffer
wrote:
On 10/12/18 6:06 AM, Kagamin wrote:
On Thursday, 11 October 2018 at 23:17:15 UTC, Jonathan Marler
wrote:
[...]
That's https://issues.dlang.org/show_bug.cgi?id=14186
Wow, interesting that C precedence is different from C
On Thursday, 11 October 2018 at 23:17:57 UTC, Jonathan M Davis
wrote:
On Thursday, October 11, 2018 8:35:34 AM MDT James Japherson
via Digitalmars-d wrote:
Certainly, major languages like C, C++, Java, and C# all do it
the way that D does, and they all have the same kind of
precedence for the
On Thursday, 11 October 2018 at 23:17:15 UTC, Jonathan Marler
wrote:
On Thursday, 11 October 2018 at 21:57:00 UTC, Jonathan M Davis
wrote:
On Thursday, October 11, 2018 1:09:14 PM MDT Jonathan Marler
via Digitalmars-d wrote:
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
On 10/12/18 6:06 AM, Kagamin wrote:
On Thursday, 11 October 2018 at 23:17:15 UTC, Jonathan Marler wrote:
I had a look at the table again, looks like the ternary operator is on
there, just called the "conditional operator". And to clarify, D's
operator precedence is close to C/C++ but doesn't ma
On Thursday, 11 October 2018 at 23:17:15 UTC, Jonathan Marler
wrote:
I had a look at the table again, looks like the ternary
operator is on there, just called the "conditional operator".
And to clarify, D's operator precedence is close to C/C++ but
doesn't match exactly. This is likely a resu
On 10/11/18 9:16 PM, Jonathan Marler wrote:
On Thursday, 11 October 2018 at 23:29:05 UTC, Steven Schveighoffer wrote:
On 10/11/18 7:17 PM, Jonathan Marler wrote:
I had a look at the table again, looks like the ternary operator is
on there, just called the "conditional operator". And to clarify
On Thursday, 11 October 2018 at 23:29:05 UTC, Steven
Schveighoffer wrote:
On 10/11/18 7:17 PM, Jonathan Marler wrote:
I had a look at the table again, looks like the ternary
operator is on there, just called the "conditional operator".
And to clarify, D's operator precedence is close to C/C++
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
Took me about an hour to track this one down!
A + (B == 0) ? 0 : C;
D is evaluating it as
(A + (B == 0)) ? 0 : C;
That's why shouldn't compose it like that.
It's been a constant source of bugs in C/C++ code:
https://www.viv
On 10/11/18 7:17 PM, Jonathan Marler wrote:
I had a look at the table again, looks like the ternary operator is on
there, just called the "conditional operator". And to clarify, D's
operator precedence is close to C/C++ but doesn't match exactly. This
is likely a result of the grammar differ
On Thursday, 11 October 2018 at 21:57:00 UTC, Jonathan M Davis
wrote:
On Thursday, October 11, 2018 1:09:14 PM MDT Jonathan Marler
via Digitalmars-d wrote:
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
> Took me about an hour to track this one down!
>
> A + (B == 0) ? 0 :
On Thursday, October 11, 2018 8:35:34 AM MDT James Japherson via
Digitalmars-d wrote:
> Took me about an hour to track this one down!
>
> A + (B == 0) ? 0 : C;
>
> D is evaluating it as
>
> (A + (B == 0)) ? 0 : C;
>
>
> The whole point of the parenthesis was to associate.
>
> I usually explicitly
On Thursday, October 11, 2018 1:09:14 PM MDT Jonathan Marler via
Digitalmars-d wrote:
> On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
>
> wrote:
> > Took me about an hour to track this one down!
> >
> > A + (B == 0) ? 0 : C;
> >
> > D is evaluating it as
> >
> > (A + (B == 0)) ? 0
On 10/11/2018 07:35 AM, James Japherson wrote:
Took me about an hour to track this one down!
A + (B == 0) ? 0 : C;
D is evaluating it as
(A + (B == 0)) ? 0 : C;
Friends don't let friends use the ternary operator except in trivial cases.
This would be a good thing for a linter to check.
Th
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
Took me about an hour to track this one down!
A + (B == 0) ? 0 : C;
D is evaluating it as
(A + (B == 0)) ? 0 : C;
The whole point of the parenthesis was to associate.
I usually explicitly associate precisely because of thi
On 11/10/18 20:16, Kagamin wrote:
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson wrote:
In the ternary operator it should treat parenthesis directly to the
left as the argument.
I don't think parentheses are ever treated like that. They are
self-contained and don't affect opera
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
Took me about an hour to track this one down!
A + (B == 0) ? 0 : C;
D is evaluating it as
(A + (B == 0)) ? 0 : C;
As it should.
The whole point of the parenthesis was to associate.
I usually explicitly associate precis
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
In the ternary operator it should treat parenthesis directly to
the left as the argument.
I don't think parentheses are ever treated like that. They are
self-contained and don't affect operators outside them.
On Thursday, 11 October 2018 at 14:35:34 UTC, James Japherson
wrote:
Took me about an hour to track this one down!
A + (B == 0) ? 0 : C;
D is evaluating it as
(A + (B == 0)) ? 0 : C;
The whole point of the parenthesis was to associate.
I usually explicitly associate precisely because of thi
On 12/10/2018 3:35 AM, James Japherson wrote:
Took me about an hour to track this one down!
A + (B == 0) ? 0 : C;
D is evaluating it as
(A + (B == 0)) ? 0 : C;
The whole point of the parenthesis was to associate.
I usually explicitly associate precisely because of this!
A + ((B == 0) ? 0 :
20 matches
Mail list logo