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,618 of 33,346    |
|    =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?= to All    |
|    Re: Looking for an elegant way to conver    |
|    04 Nov 11 05:47:38    |
   
   d64f14d5   
   From: daniel.kruegler@googlemail.com   
      
   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 ;-)   
      
   Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
    [ 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