Peter Gerwinski wrote:
I encountered some problems with Procedures accepting `CString' parameters. When passing a string constant to such a parameter, GPC does *not* automatically add a "chr ( 0 )" terminator.
Should it do? And if so, in which cases? We always can explicitly write "foo ( 'bar'#0 );" instead of just "foo ( 'bar' );", so I tend to let things like they are ...
I think it should automatically add a #0 terminator. After all, a "CString" without terminator is somewhat undefined.
In which cases? I think always when a string constant is given where a "CString" value is expected, whether for a parameter, or a variable initializer. E.g. the following should work as expected:
var numbers:array[1..3] of cstring value (1:'one';2:'two';3:'three');
or in BP syntax:
const numbers:array[1..3] of pchar=('one','two','three');
Many of my programs rely on this.