using assignment statement as conditional in a where

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 3 17:23:34 PST 2016


On 04/12/2016 7:26 AM, dan wrote:
> On Saturday, 3 December 2016 at 09:03:25 UTC, rikki cattermole wrote:
>> On 03/12/2016 9:55 PM, dan wrote:
>>> [...]
>>
>> If you can use another compiler do so, gdc is on an old
>> frontend/Phobos now. I recommend ldc or you know the reference
>> compiler dmd if performance/platform isn't an issue (not that dmd
>> can't produce decent codegen).
>>
>> This does compile:
>>
>> int func() {
>>     return 0;
>> }
>>
>> void main() {
>>     int x;
>>     while((x = func()) != 0) {
>>
>>     }
>> }
>
> Thanks Rikki, that works great and is nearly ideal (doesn't seem to
> allow 'auto' but probably that's some scoping issue).
>
> I do prefer gdc because it is gpl'ed, but appreciate any suggestions.
>
> Thanks again for your help!
>
> dan

The only thing in gdc that is GPL is the backend and glue layer.
The frontend is the same one in ldc and dmd.


More information about the Digitalmars-d-learn mailing list