Should this Compile?
SamwiseFilmore
mggmugginsmc at gmail.com
Wed Oct 4 02:21:15 UTC 2017
On Tuesday, 3 October 2017 at 23:13:00 UTC, Jonathan M Davis
wrote:
> On Tuesday, October 03, 2017 22:42:35 SamwiseFilmore via
> Digitalmars-d-learn wrote:
>> On Tuesday, 3 October 2017 at 22:37:17 UTC, SamwiseFilmore
>> wrote:
>> > Am I using the ternary operator correctly here, or is this
>> > an issue with dmd? I'm using dmd v2.076.0.
>>
>> I wrapped the ternary in parentheses, and it compiled. Still,
>> I'm wondering about this behavior.
>
> Operator precedence makes it quite clear how the ternary
> operator is supposed to function, and if you're ever not sure,
> then put parens around it.
>
> https://wiki.dlang.org/Operator_precedence
>
> - Jonathan M Davis
Thanks, that clears things up. I appreciate it!
More information about the Digitalmars-d-learn
mailing list