joe@modcomp.UUCP (08/19/88)
Jeff Siegal (jbs @ fenchurch.mit.edu.UUCP) writes: >In article <8553@ihlpb.ATT.COM> nevin1@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
jbs@fenchurch.MIT.EDU (Jeff Siegal) (08/20/88)
In article <8000001@modcomp> joe@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