Re: qsort and arbitrary types
From: Catherine Rees Lay (spamtrap_at_polyhedron.org.uk)
Date: 06/11/04
- Next message: igor: "Re: "Free" GUI Design?!?"
- Previous message: Catherine Rees Lay: "Re: C++ wrapper for a fortran77 program??"
- In reply to: Janne Blomqvist: "Re: qsort and arbitrary types"
- Next in thread: glen herrmannsfeldt: "Re: qsort and arbitrary types"
- Reply: glen herrmannsfeldt: "Re: qsort and arbitrary types"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 11 Jun 2004 09:38:38 +0100
In article <slrnccf3ru.2f0.jblomqvi@vipunen.hut.fi>, Janne Blomqvist
<jblomqvi@roskaposti.invalid> writes
>In article <m1smd41m52.fsf@macfortran.local>, Richard Maine wrote:
>
>[pass by reference...]
>
>> With newer features and compilers, the exceptions are becoming less
>> and less exceptional. Some new features are pretty much impossible to
>> implement with pass by reference. Even for old features, things like
>> copy-in/copy-out are sometimes used by modern optimizers.
>
>You are of course correct. Although I perhaps didn't express myself
>very clearly, what I meant was that semantically, argument passing
>behaves like pass by reference in the sense that modifying an argument
>in a procedure also modifies it in the caller. Obviously, if an
>argument is marked as INTENT(IN) or VALUE that isn't true, but I was
>talking about the "general" case.
>
>Whether the argument passing is actually implemented as pass by
>reference, pass by value-result or in some other way is implementation
>dependent, as you say.
>
>> I recommend against programming based on the assumption that arguments
>> will be passed by reference. It certainly doesn't seem like an
>> assumption that will leave you well prepared for the future... or
>> even some parts of the present.
>
>Hmm., are there actually legal programs which work differently
>depending on if pass by reference is used or not? I can think of a few
>examples where pass by reference would differ from pass by
>value-result, but those examples would require aliasing which isn't
>allowed anyway.
>
If you can tell whether the arguments are pass-by-reference or not, the
code isn't legal.
Having said that, most (all?) mixed language programming, especially
under Windows using compilers from different vendors, requires you to
know how your compiler passes arguments. Hopefully the f2k3
interoperability stuff will remove this requirement.
Catherine.
-- Catherine Rees Lay To email me, use my first name in front of the "at".
- Next message: igor: "Re: "Free" GUI Design?!?"
- Previous message: Catherine Rees Lay: "Re: C++ wrapper for a fortran77 program??"
- In reply to: Janne Blomqvist: "Re: qsort and arbitrary types"
- Next in thread: glen herrmannsfeldt: "Re: qsort and arbitrary types"
- Reply: glen herrmannsfeldt: "Re: qsort and arbitrary types"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|