This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: How to express the fact that arguments don't escape?


On Aug 15 2009, Richard Guenther wrote:

Can the back-end distinguish traditional call by reference (as in Algol 60 and 68) from call by pointer value (and in C and C++)? The former does

No it can't. Well - the backend has the DECL_BY_REFERENCE, but it's semantics are poorly documented. Note that Fortran overly uses that predicate anyway - likely because it is also used for debug information annotation IIRC.

Thanks. That's useful information for another reason - a very off-thread one!

The difference could be useful for the C++ STL and possibly Ada, but I have forgotten the little of the latter that I once knew and so am not sure.

I don't think so. You can take the address of even passed by value objects in C++ if you make sure to remove all references in the destructor that runs after the call completes. See some previous bugs we had in this area.

That is precisely why I said the C++ STL and not C++! I agree that, in general, you can't. If I understand the standard correctly, there are quite a lot of places where that isn't relevant or falls foul of the "undefined because not defined" rule. If it IS allowed everywhere, it constrains the library far more than I thought was done.


Whether it's worth the hassle is another matter, of course ....


Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QH, England. Email: nmm1@cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679


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