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]
Other format: [Raw text]

Re: [arm] Make constructors return this


Paul Brook writes:
 > On Wednesday 04 August 2004 16:44, Andrew Haley wrote:
 > > Paul Brook writes:
 > >  > On Friday 02 July 2004 22:01, Mark Mitchell wrote:
 > >  > > Paul Brook wrote:
 > >  > > >The patch below makes full and subobject constructors and destructors
 > >  > > > return the object constructed or destroyed, as required by the ARM
 > >  > > > EABI. It doesn't yet attempt to use this information.
 > >  >
 > >  > > >+      /* We can't use the proper return type here because we run
 > >  > > > into +	 problems with abiguous bases and covariant returns.  */
 > >  > > >+      if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA
 > >  > > > (optype))
 > >  > >
 > >  > > Why not do this in the TYPE_FOR_JAVA case as well?
 > >  >
 > >  > Two reasons:
 > >  > - (void *) isn't a valid java type.
 > >  > - It would change the Java ABI, requiring corresponding changes to gcj
 > >  > and other JVMs.
 > >
 > > Why would it?  If the library doesn't use the return value, which
 > > would anything need to change?
 > 
 > Which library? g++ generated code doesn't use the return value *yet*. I'm 
 > assuming that extern "Java" can actually be implemented in Java.
 > 
 > Giving the 'structors a return type implies that it could be
 > used. Leaving the return type as void makes it clear that java
 > classes don't return the object address, and avoids ambiguity
 > if/when we decide to take advantage of this feature of the C++ ABI.

I understand that, but the CNI interface has always been designed to
be as similar as possible to the C++ ABI on any machine.  

I guess the advantage at the present time is that the Java front end
won't need to be changed.

Andrew.


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