NULL as a string terminator
Sean Legassick
cuuee at warwick.ac.uk
Sat Aug 25 01:31:58 AEST 1990
In article <1990Aug20.000227.12867 at icc.com> cbp at icc.com (Chris Preston) writes:
[quoting a quote]
>>*You* like your non-standard name for '\0', but no one else will
>>know what it means, and it's unlikely that it will ever be a Big Win
>>for you (like if we start terminating strings with ^A or something).
>
> Then, it will be a very big win. Using two characters would break
> much more software than would changing the terminator to a single
> different letter. In the case of doing a sprinkling of assembly
> on DOS or CPM, the $ is used as a terminator (typically) when calling an
> interrupt service routine. If you are doing assembly calls in a section
> of code you need only
>
[code omitted]
>
> Typically, one could even replace '$' and '\0' further with
> DOS_CPM_TERMINATOR and UNIX_DOS_C_CALL_TERMINATOR. So, while you as
> a Unix or Dos or whatever programmer might not care about the others, it
> allows a level of abstraction that facilitates portability and
> maintainability.
>
>
> Mind you, I might like shorter labels, but one get's the idea.
>
Very clever, but it hardly solves the problem of different string
representations - consider Pascal. It has not terminator, strings start with
a count. No amount of #defining will solve that.
---------------------------------------------------------------------------
Sean Legassick, cuuee at uk.ac.warwick.cu "Man, I'm so hip I find it
Computing Services (the walking difficult to see over
University of Warwick C obfuscator!) my pelvis" - D Adams
More information about the Comp.lang.c
mailing list