This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: [RFC] Marking C++ new operator as malloc?


"Richard Guenther" <richard.guenther@gmail.com> writes:

[...]

| > I think I'm getting confused.  Perhaps you could sum up in a single
| > email the argument for why putting this attribute in our standard
| > headers is safe, even in view of possible replacement in user programs?
| 
| My argument goes like "We can safely put attribute malloc on all overloads
                                                            ^^^^^^^^^^^^^^^^^
| of new as C++ starts lifetime of  a new object in the target and accesses to
| old objects at that location invoke undefined behavior".  I claim that you
| cannot construct a testcase with no undefined behavior that has two
| pointers returned from a call to 'new' alias.

I don't think I understand the claim.  The C++ does not say anything
about all overloads in terms of aliasing.  IT makes claims about
specific `operator new's.  Could you elaborate on why it is OK to
annotate all overloads?

-- Gaby


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