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 31,619 of 33,346   
   Gennaro Prota to daniel.kruegler@googlemail.com   
   Re: Looking for an elegant way to conver   
   04 Nov 11 16:42:41   
   
   From: gennaro.prota@gmail.com   
      
   On Fri, 04 Nov 2011 13:47:38 +0100, Daniel Krügler   
    wrote:   
      
   > On 2011-11-04 09:35, Andrzej Krzemieński wrote:   
   >> I also thought this way at first, but in Castor's example error code   
   >> is a mandatory output argument for each function. You cannot   
   >> inadvertently ignore it, because then the compiler will protest about   
   >> the missing argument. You can obviously cheat by passing a dummy   
   >> argument, but this is an "explicit ignore", similar to catch(...){}   
   >   
   > Experience shows that this is wishful thinking ;-) It doesn't much   
   > matter whether you need to provide an argument to the function. You can   
   > (and the resistant once will for sure) simply ignore what the function   
   > has written to it.   
   >   
   > In fact a coworker of mine had suggested a while ago the following to   
   > make error-code based more robust against other resistant coworkers that   
   > tend to ignore to check these error values: Just invent a class type   
   > that behaves like an error code value, but recognices whether its value   
   > has been read or not. In the destructor of this wrapper check for   
   > reading and either terminate or throw an exception (as ugly as this   
   > might be), to prevent that user ignores reading the value.   
   >   
   > As you see, this was just the opposite suggestion as what the OP meant,   
   > but I'm sure that even such a class would not prevent sufficiently   
   > resistant people to still ignore the value ;-)   
      
   It is normally assumed that the programmer controls the code, and not   
   viceversa. If time comes where such "devices" seem to be in order then   
   probably time has already gone when you had to consider changing your   
   staff.   
      
   --   
     Gennaro Prota         |           name.surname gmail.com   
       Breeze C++ (preview):    
       Do you need expertise in C++?   I'm available.   
      
      
         [ 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