home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,006 of 33,346   
   DeMarcus to All   
   Re: What does null mean?   
   27 Apr 13 07:16:00   
   
   From: demarcus_at_hotmail_com@tellus.orb.dotsrc.org   
      
   >>> Or provide a function that decides what to do in such a case   
   >>>   
   >>> CameraMan cm( GetDefaultAngle() );   
   >>   
   >> This also solves the problem I'm trying to solve, I just suggested the   
   >> symbolic constant for the efficiency.   
   >   
   > Why not:   
   >   
   > inline AnglePtr GetDefaultAngle() { return nullptr; }   
   >   
      
   That's also a solution. In my particular case I wanted to be explicit   
   with the fact that the angle is missing. If the function returns   
   something 'default' then I have to check the documentation what that   
   default value is.   
      
   >>> My general point is that in cases where the meaning of nullptr when used   
   >>> as that isn't obvious, chances are that it's being abused as a special   
   >>> value -- and I don't like special values in general, not just with   
   >>> pointers. (For example, imagine an interface where an integer argument   
   >>> can have meaningful positive values and the negative values -1, -2 and   
   >>> -3 are 'overloaded' to trigger special behavior. Shudder.)   
   >>>   
   >>   
   >> I completely agree. That's actually another investigation I'm working on   
   >> how to solve that situation in a clean way. First time I realized the   
   >> complexity of it was at a time when I had to store measured values.   
   >> Except from a decimal value I also needed to store whether it had been   
   >> measured at all (0.0 is not a good value to store when the value is   
   >> missing), if the signal of the measure was too weak to be within   
   >> operational range, and (after some statistics calculations) if the   
   >> measure was an outlier.   
   >   
   > Use boost::optional which will be std::optional in C++ 14.   
   >   
      
   Great! I was just about to ask where I can find information about C++14   
   and C++17 but I found one good page.   
   http://www.meetingcpp.com/index.php/br/items/a-look-at-cpp14-papers-part-1.html   
      
   If you scroll down to the bottom the page there's a link to Part 2 and 3.   
      
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca