[pdal] questions about iterator and buffer semantics
Chris Foster
chris.foster at roames.com.au
Wed Jul 3 05:19:50 PDT 2013
On Wed, Jul 3, 2013 at 7:21 PM, Mateusz Loskot <mateusz at loskot.net> wrote:
> The problem I've got with nullptr is that it does not necessarily mean
> "invalid value". It means, "something could not deliver a value",
> but if something can deliver and the value delivered is invalid...
Let me paraphrase to see if I understand you here. The distinction is
"a failure occurred while trying to find the value" vs
"things worked but the value wasn't present". For the getDimensionOptional()
case, that would be something like
"memory could not be allocated so the search for the dimension failed" vs
"everything worked, but the dimension wasn't present"
In my opinion the first is neatly captured by an exception (the program
encountered a hard failure which the function wasn't prepared to deal with),
whereas in the second case nullptr can simply be returned. In this way it seems
like nullptr can have perfectly well defined semantics.
~Chris
More information about the pdal
mailing list