if Condition expression can't have function?

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 25 04:52:42 PDT 2014


On 25/04/2014 08:29, Matthias Walter via Digitalmars-d wrote:
>>      size_t find(T[] Array,T Element)
>> >     {
> find returns a size_t being a nonnegativ number.
>
>> >     return -1;
> But here it returns -1.

For size_t and uint 'dmd -w' seems to allow returning literal -1, but 
with ubyte I get:
Error: cannot implicitly convert expression (-1) of type int to ubyte

Is this inconsistent or is there a reason for this?


More information about the Digitalmars-d mailing list