[comp.std.c] The \z escape

ERICMC@USU.BITNET (Eric Tye McQueen) (06/22/88)

Another problem that \z would fix is a problem introduced by the standard
that I missed in my first (incomplete) reading of it:

char str[4]= "Help";

would have to compile without error.  If the compiler doesn't even give a
warning,   strchr(str,"z")   is going to be a bit of a surprise.  If it does
give a warning, initializing strings without a trailing null is going to be
annoying.

As Chris mentioned, the committee seems to see a need for non-null-terminated
strings.  Generating a warning every time you use a feature there is a genuine
need for (I mean, they made the language fatter for it) can't be an acceptable
practice.  Creating the maintenance nightmare of strings suddenly losing their
trailing nulls because someone didn't notice that there isn't room for it any
longer can't be an acceptable practice.

I've already run into problems where people forgot to count the trailing null
when computing the size of an array.  Luckilly the compilers currently check
this for you when they can (when you specify the string as an initializer).

Along with the other (also small) reasons for adding \z, I think this justifies
the almost trivial changes to be made to the standard specification.  I havn't
heard *ANY* arguments saying that it shouldn't be added other than "It's not
worth the effort."

I think it's right on the border line as far as last minute changes go.  I
wouldn't be surprised if it didn't make it in, but it'd be a nice change.
Who would it hurt?  (or is it just the fear that after the final draft a
horde of screaming programmers will suddenly decide that \z is the worst
thing since "noalias" and fire bomb committee members' houses?)

Humbly,

Eric Tye McQueen              (801) 753-4683                P.O. Box 159
ericmc@usu.bitnet      Soon to be ericmc@cc.usu.edu      Logan, Utah  84321

UUCP: ...{psuvax1,uunet}!usu.bitnet!ericmc      "I'm going to leave before
Arpa: ericmc%usu.bitnet@cunyvm.cuny.edu     someone baptizes me or something."

gwyn@brl-smoke.ARPA (Doug Gwyn ) (06/22/88)

In article <8806220649.AA01761@jade.berkeley.edu> ERICMC@USU.BITNET (Eric Tye McQueen) writes:
>char str[4]= "Help";
>would have to compile without error.

That's already common practice; it wasn't invented by X3J11.

>I wouldn't be surprised if it didn't make it in, but it'd be a nice change.
>Who would it hurt?

Any substantive change at this point would delay the final standard by
several months.  The general committee sentiment appears to be that we
could keep up the small tweaks forever, but that the present draft is
sufficient.  The proponent of any additional non-editorial change will
have to demonstrate that the change is important enough to justify
delaying the standard.  "Nice change" won't cut it.

scjones@sdrc.UUCP (Larry Jones) (06/24/88)

In article <8806220649.AA01761@jade.berkeley.edu>, ERICMC@USU.BITNET (Eric Tye McQueen) writes:
> Who would it hurt?  (or is it just the fear that after the final draft a
> horde of screaming programmers will suddenly decide that \z is the worst
> thing since "noalias" and fire bomb committee members' houses?)

The problem is that if we make any substantive changes (i.e. anything but
editorial corrections), we are REQUIRED by ANSI rules to have another 2
month public review which would delay the final standard by about 6 months.
If we don't get this thing done pretty soon, it's going to be obsolete!

----
Larry Jones                         UUCP: ...!sdrc!scjones
SDRC                                AT&T: (513) 576-2070
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150
"When all else fails, read the directions."