D
David Thompson
On Tue, 25 Aug 2009 07:34:53 -0700 (PDT), Nick Keighley
the index' but alternatively I might say 'stores' or 'sets'.
Pascal VAR/non specifies mechanism. Ada in/out/inout may influence it,
but does not require it. Some _types_ do: elementary types must be
by-value (called by-copy), tagged (aka polymorphic or dispatching)
types and a few others must be by-reference, and the rest are up to
the implementation's choice. 'in' may improve the chances of the
implementation choosing by-value, but doesn't require it.
Fortran90 adds INTENT IN/OUT/INOUT, which similarly does not control
but may influence mechanism. F03 adds VALUE which forces by-value
in limited cases; this was motivated mostly by C-interop, but can be
used otherwise. F90 'target' rules effectively require by-reference in
limited cases, and for any type you can have an explicit IN POINTER
(implicitly derefed in callee, but explicitly enabled in caller) and
in F03 you can use a C-interop pointer by value (explicit both sides).
elements vs. pointer notation when it's only one (or maybe none).
But this is only my convention; the compiler doesn't check it.
In C99 I could use double sum ( size_t n, double v [n] )
but I'm in the C99-isn't-sufficiently-available-yet camp.
First, I'd make that const Dictionary *. I might say 'also returnsConsider
success_t search (int *index, Dictionary *dict, Value val);
I'd quite happily say "A Dictionary is passed to the search function,
if the
search suceeds the function returns true and also returns the index
of the value found".
the index' but alternatively I might say 'stores' or 'sets'.
(SpellNit: eccentric.)See no pointers or references
I quite like Ada's in, out and inout parameters. Though in practice I
don't use the terms. I suppose I still think in a Pascal-like way
and just treat C's pointers and The Rule as its slightly excentric
of providing me with what I want.
Pascal VAR/non specifies mechanism. Ada in/out/inout may influence it,
but does not require it. Some _types_ do: elementary types must be
by-value (called by-copy), tagged (aka polymorphic or dispatching)
types and a few others must be by-reference, and the rest are up to
the implementation's choice. 'in' may improve the chances of the
implementation choosing by-value, but doesn't require it.
Fortran90 adds INTENT IN/OUT/INOUT, which similarly does not control
but may influence mechanism. F03 adds VALUE which forces by-value
in limited cases; this was motivated mostly by C-interop, but can be
used otherwise. F90 'target' rules effectively require by-reference in
limited cases, and for any type you can have an explicit IN POINTER
(implicitly derefed in callee, but explicitly enabled in caller) and
in F03 you can use a C-interop pointer by value (explicit both sides).
I like to use array notation when it is (at least usually) multipleI've never found
swap (&a, &b);
either natural or elegant. I *might* say a and b were passed by
reference.
I want to pass an array so I use array notation
double sum (double vector[], size_t size);
even though some people would say it confuses things to
hide the pointer
elements vs. pointer notation when it's only one (or maybe none).
But this is only my convention; the compiler doesn't check it.
In C99 I could use double sum ( size_t n, double v [n] )
but I'm in the C99-isn't-sufficiently-available-yet camp.