| 1234567891011121314151617181920 |
- { t55_strcat_overflow: concatenating past the maximum is a RUNTIME error.
- A `string' is string[255] - a length byte and 255 characters - so the scratch
- a concatenation writes into cannot hold more than 255. Reading 128
- characters and then doing `s := s + s' asks for 256. TP3's xconcat raises
- "string too long" (error 16) instead of truncating, and this runtime leaves
- through INT 21h AH=4Ch with AL=16.
- `after' must NOT appear: the error path leaves the program, it does not set a
- flag, truncate, and carry on. The .out pins where it stopped and the .exit
- file pins WHY - exit 16, not the 0 progend would give. }
- program t55_strcat_overflow (input, output);
- var
- s : string;
- begin
- readln (s);
- writeln ('read');
- s := s + s;
- writeln ('after')
- end.
|