Empty VS null array?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Oct 18 16:30:47 PDT 2013


On Sat, Oct 19, 2013 at 12:45:02AM +0200, ProgrammingGhost wrote:
> On Friday, 18 October 2013 at 21:15:32 UTC, H. S. Teoh wrote:
> >On Fri, Oct 18, 2013 at 10:04:52PM +0200, Meta wrote:
> >>On Friday, 18 October 2013 at 19:59:26 UTC, H. S. Teoh wrote:
> >>>...because it eliminates an unnecessary distinction between an
> >>>empty sequence and a non-existent sequence (which then leads to
> >>>similar issues one encounters with null pointers).
> >>
> >>That just seems silly. Surely we all recognize that there's a
> >>difference between the empty set and having no set at all, and that
> >>it's valuable to be able to distinguish between the two. The empty
> >>set is still a set, while nothing is... nothing.
> >
> >Yes, but if you declare a variable to contain a set, then by
> >definition there is *something*, even if it's an empty set. For there
> >to be nothing, there shouldn't even be a variable in the first place.
> >The fact that the variable exists and has an identifer means that
> >there is *something*. So your argument is moot.
> >
> >
> >T
> 
> I was simply thinking about sdl where you pass in a rect for the
> coords to blt one surface to the other. Null/0 means copy the whole
> thing. Rect is an object but I was thinking what about arrays (empty
> VS pull a default somewhere). Thats how I came up with this question
> and the point is I WANT to NOT specify a value so a DYNAMIC SUITABLE
> default value can be used.

You could use T[]* and pass a null pointer as default?


T

-- 
What is Matter, what is Mind? Never Mind, it doesn't Matter.


More information about the Digitalmars-d mailing list