Empty VS null array?

Max Samukha maxsamukha at gmail.com
Sat Oct 19 07:38:23 PDT 2013


On Saturday, 19 October 2013 at 12:04:43 UTC, Kagamin wrote:
> On Friday, 18 October 2013 at 17:59:17 UTC, Max Samukha wrote:
>> On Friday, 18 October 2013 at 16:55:19 UTC, Andrei 
>> Alexandrescu wrote:
>>>
>>> Fair point. I just gave one possible alternative out of many. 
>>> Thing is, relying on client code to distinguish subtleties 
>>> between empty and null strings is fraught with dangers.
>>>
>>> Andrei
>>
>> I agree. Thinking about your variant of readln - it's ok to 
>> use [] as the value indicating EOF, since it is not included 
>> in the value set of type "line" as you define it.
>
> No, if the last line is empty, it has no new line character(s) 
> at the end, and is as empty, as it can get.

Right. Then readln is broken.


More information about the Digitalmars-d mailing list