d35ded84   
   From: daniel.kruegler@googlemail.com   
      
   On 2011-11-09 00:49, Jens Auer wrote:   
   > On 8 Nov., 09:06, Carlos Moreno wrote:   
   >> Still, it seems quite shocking that the standard would not   
   >> explicitly say something about accessing any member through   
   >> dereferencing a NULL pointer. Or, for that matter, simply   
   >> stating something about dereferencing a null pointer. I   
   >> mean, for example, what would be the wording that states   
   >> that the following is undefined behaviour:   
   >>   
   >> int * p = NULL;   
   >> int a = *p;   
   >>   
   >> How would that wording (which I'm sure there has to be some   
   >> *explicit* statement about the undefined-behaviour-ness of the   
   >> above) not be general enough to cover the use of a NULL pointer   
   >> to invoke a method on the pointed (inexistent) object as well??   
   >   
   > I don't have a copy of the new C++11 standard, but the old one says   
   > so:   
   > 1.9.4: "Certain other operations are described in this International   
   > Standard as undefined (for example, the effect of dereferencing the   
   > null pointer)."   
      
   This is not such a good example, because the core language is currently   
   in the process to replace this example by another one, because they want   
   to allow for "empty lvalues", which cannot undergo lvalue-to-rvalue   
   conversion. For more details see   
      
   http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#232   
      
   HTH & 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)   
|