Problems with strings in GPC beta 971001_(re)
Tue, 28 Oct 1997 20:15:27 GMT
Jesper Lund wrote:
> MY MISTAKE! Read[ln] work correctly and never exceeds the string capacity,
> and my problems are totally UNrelated to the missing range checks in some
> string expressions that I mentioned in the original post.
I'm calmed! :-)
> ADVICE TO GPC USERS:
>
> If you add #0 to a string (in order to call functions in the C library), it
> is a *very* good idea to use strings whose capacity (max length) are not
> divisible by 4. In that case, at least one byte is "wasted" to achieve
> 4-byte alignment, and adding #0 should not overwrite other variables.
I'm not sure if it's a good idea to rely on such internal things. The
alignment could be different from 4 on some systems.
However, we have already discussed automatically making the array bigger than
the capacity by 1 for exactly this reason. I hope it's not much work, Peter,
so perhaps you can do this change until the next version (whereas the
automatic String-CString conversions will follow later).
--
Frank Heckenbach, Erlangen, Germany
heckenb@mi.uni-erlangen.de
http://home.pages.de/~fjf/links.htm
Frank Heckenbach (heckenb@mi.uni-erlangen.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es