This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: aliasing warnings [patch]


>>>>> Mark Mitchell <mark@codesourcery.com> writes:

>>>>> "Jason" == Jason Merrill <jason@cygnus.com> writes:
 Jason> It seems to me that the assignment creates a new object of
 Jason> type 'int' in the space previously occupied by the array.

 > Since we're being pedantic, do you have evidence of this in the
 > standard?

>From the C++ standard:

3.8 - Object Lifetime [basic.life]

-1- The lifetime of an object is a runtime property of the object. The
 lifetime of an object of type T begins when: 

 * storage with the proper alignment and size for type T is obtained, and 
 * if T is a class type with a non-trivial constructor (class.ctor), the
   constructor call has completed. 

 The lifetime of an object of type T ends when: 

 * if T is a class type with a non-trivial destructor (class.dtor), the
   destructor call starts, or 
 * the storage which the object occupies is reused or released. 

-4- A program may end the lifetime of any object by reusing the storage
 which the object occupies or by explicitly calling the destructor for an
 object of a class type with a non-trivial destructor.

I don't know where to look for this sort of thing in the C standard.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]