OT: Of C, Fortran and pointer aliasing Was: Python if far from a top performer...
danb_83 at yahoo.com
Mon Jan 12 10:10:11 CET 2004
Samuel Walters <swalters_usenet at yahoo.com> wrote in message news:<pan.2004.01.11.10.38.45.810669 at yahoo.com>...
> |Thus Spake Rainer Deyke On the now historical date of Sun, 11 Jan 2004
> 06:46:50 +0000|
> > Samuel Walters wrote:
> [Fortran is faster than C.]
> I went digging for technical documents, but thus far haven't found many
> useful ones. It seems everyone but me already understands pointer
> aliasing models, so they might discuss them, but they don't explain them.
> I am limited in part by my understanding of compilers and also by my
> understanding of Fortran. Here is what I have gathered so far:
> Fortran passes all arguments by reference. (This is the peppiest way to do
> it, especially with static allocation)
Btw, for some early compilers, this was the case even with literals,
which meant that code like
PRINT *, 4
could print something other than 4.
> ...I'm a bit hazy as to whether
> Fortran 90 uses static or dynamic allocation, or a combination of both,
You can use both, at least for arrays.
> and whether it permits recursion.
Fortran 90 does permit recursion, although you have to explicitly
declare functions as "recursive".
> Now, for C:
> C lacks many of the fundamental array handling semantics and primitives
> that Fortran programs rely on. Implementing them in C is a real PITA.
This is one of my least favorite things about C.
> C memory allocation is just plain goofy in comparison to Fortran.
And even worse in comparison to Python ;-)
More information about the Python-list