problems using sizeof()

joe at modcomp.UUCP joe at modcomp.UUCP
Sat Aug 20 01:11:00 AEST 1988


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

>In article <8553 at ihlpb.ATT.COM> nevin1 at 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



More information about the Comp.lang.c mailing list