Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problems using sizeof()

0 views
Skip to first unread message

j...@modcomp.uucp

unread,
Aug 19, 1988, 11:11:00 AM8/19/88
to

Jeff Siegal (jbs @ fenchurch.mit.edu.UUCP) writes:

>In article <85...@ihlpb.ATT.COM> nev...@ihlpb.UUCP (55528-Liber,N.J.) writes:
> >[...]the more general problem of determining the size of an array which is
> >passed via a pointer cannot be done in C.
>
>Nor in any other language, [...] You can't tell the size of an object from a
>pointer to it.

Not true for Fortran 77. The semantics of the language require that the size
of a character string argument also be passed to a procedure. The construct
which requires this feature is:

SUBROUTINE FOO(CA)
CHARACTER*(*) CA
:
END

The asterisk in parens forces CA to assume the size of the calling argument on
each instantiation of the procedure.

Joe Korty
uucp!modcomp!joe

Jeff Siegal

unread,
Aug 20, 1988, 4:50:46 AM8/20/88
to
In article <8000001@modcomp> j...@modcomp.UUCP writes:
>Jeff Siegal (jbs @ fenchurch.mit.edu.UUCP) writes:
>>You can't tell the size of an object from a
>>pointer to it.
>
>Not true for Fortran 77. The semantics of the language require that the size
>of a character string argument also be passed to a procedure.

Did you READ my article? I made this exact point in the next
paragraph. More than just the pointer is being passed. The length is
being passed separately, although the language hides this. C doesn't
(have hidden arguments).

Jeff Siegal

0 new messages