strings

phil at ux1.cso.uiuc.edu phil at ux1.cso.uiuc.edu
Fri May 19 01:42:00 AEST 1989


> The major problem with using anything other than \0-terminated
> strings in C is that you give up the easy ability to define
> string constants a la "/etc/passwd".  Standard C compilers will
> create a \0-terminated string for these, regardless of what
> your home-made string utilities prefer.

If you wanted to redefine how strings worked as a part of the language
or as a special implementation, then the constants would of course be
defined that same way.  "/etc/passwd" is, of course, NOT a string, but
a constant address of array of char.  That is part of the origins of C.
A language extension could create a string primitive type, and the
compiler would have to build "/etc/passwd" as (string) or as (char *)
as appropriate to the type of usage.

--phil howard--



More information about the Comp.lang.c mailing list