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,272 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to Martin Bonner   
   Re: Variable declaration and initializat   
   15 Jan 14 05:06:25   
   
   From: ootiib@hot.ee   
      
   On Wednesday, 15 January 2014 02:36:11 UTC+2, Martin Bonner  wrote:   
   > On Monday, January 13, 2014 9:25:39 PM UTC, Dave Harris wrote:   
   > > In article <42cf56bc-29b1-490d-8c8b-ac8b0b10300b@googlegroups.com>,   
   > > >    double a = a * 2.0;   
   > >   
   > > That use is undefined because a is read before being initialised. A   
   > > use like:   
   > >   
   > >      void *p = &p;   
   > >   
   > > is well-defined and possibly useful, for example when defining   
   > > circular linked lists.   
   >   
   > Nit:  In C++ that would have to be written as:   
   >      void *p = static_cast(&p);   
      
   If it is some new draft of C++ then please specify. If you just made   
   mistake, then there are nice tools for testing your claims:   
   http://ideone.com/SQH3yu   
      
   Several (both C and C++) experts suggest to avoid redundant 'void*'   
   casts because those may make code less readable and may silence   
   diagnostics.   
      
      
   --   
         [ 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