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,529 of 33,346   
   Zeljko Vrba to daniel.kruegler@googlemail.com   
   Re: Address identity of functions   
   03 Oct 11 11:57:36   
   
   From: mordor.nospam@fly.srk.fer.hr   
      
   On 2011-10-02, Daniel Krügler  wrote:   
   >   
   > There are some compilers that deduce from this, that the following program   
   is allowed to output '1' instead of '0':   
   >   
   Which compilers? :)   
      
   Did you check whether this is the case when both functions are non-empty, but   
   have identical code?   
      
   >   
   > Irrespective of whether this behaviour of those compilers would be a defect   
   according the current standard, I would be interested in code examples that   
   would no longer work, if there would be no unique address identity guarantee   
   for functions.   
   >   
   Self-modifying code (I guess an area with a big UB-sign above it :)).  If you   
   modify f and/or g at runtime, you really do need two copies.  Heck, it would   
   also break debuggers as they usually put a breakpoint by replacing instructions   
   at the start of a function.  So you wouldn't be able to put breakpoint on f   
   and g independently.   
      
      
   --   
         [ 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