{ Automatic conversion of "array of CHAR" to PChar } { is accompanied by making a copy of the specified argument. } { This is unsuitable for an output parameter -- the returned } { value is lost. } { "@s[1]" produces an address, but triggers range checking } { when "s" is a STRING, so "s" needs to be initialized } { before it can be passed to a procedure that won't pay any } { attention to its initial value. } program JSM3( INPUT, OUTPUT ) ; var CARR : array [ 1 .. 8 ] of CHAR ; STR : STRING( 6 ) ; procedure SET_SOME( BUF : PChar ) ; var P : PChar ; begin P := BUF ; P^ := 'O' ; P := PChar( PtrCard( P ) + 1 ) ; P^ := 'K' ; end ; begin CARR := 'FAIL' ; WRITELN( CARR, ' before SET_SOME' ) ; SET_SOME( CARR ) ; WRITELN( CARR, ' after SET_SOME' ) ; SET_SOME( @STR[1] ) ; { RangeCheckError unless Length happens to be good } SetLength( STR, 2 ) ; WRITELN( STR, ' after SET_SOME' ) ; end.