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 32,013 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: Incomplete class with auto_ptr   
   15 Mar 12 14:58:48   
   
   119742a6   
   From: daniel.kruegler@googlemail.com   
      
   Am 03.03.2012 21:11, schrieb Joshua Maurice:   
   > This is also very related to "delete p;" where p is a pointer to   
   > void.   
   >   
   > Why not make such things "required diagnostics" in the standard, ergo   
   > hopefully resulting in proper "failure to compile" error messages from   
   > compilers? I guess I'm asking how does the current state of affairs   
   > make "the C people" happy? If they want to free memory with free(),   
   > they're free to do so, but the new delete thingy could have been made   
   > to take only pointers to complete (and non-void) types.   
      
   Note that during the C++11 standardization this state of affairs has   
   improved: Attempting to delete a pointer to void is ill-formed.   
   [expr.delete] p1 says now:   
      
   "The operand shall have a pointer to object type, or a class type having   
   a single non-explicit conversion function (12.3.2) to a pointer to   
   object type. The result has type void. (footnote: This implies that an   
   object cannot be deleted using a pointer of type void* because void is   
   not an object type.)"   
      
   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)   

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


(c) 1994,  bbs@darkrealms.ca