shorten string length by 1

K

Keith Thompson

Mark McIntyre said:
On Sun, 17 Apr 2005 08:03:09 GMT, in comp.lang.c , Keith Thompson


such as the one under discussion.

If you were just talking about the particular case under discussion,
I'd agree with you.
And even setting aside the context,
I still don't consider a character array with only a null in it to be
a string. YMMV.

That's just wrong. The definition of "string" in C99 7.1.1p1 could be
interpreted to exclude empty strings, but it's obviously the intent
that the empty string is a string. If you want to refer to non-empty
strings, find another word.
 
?

=?ISO-8859-1?Q?Gerg=F6_Barany?=

Mark said:
How so? The context was how to shorten a string by one character. I'm
unsure how a zero length string can be valid for that operation. And
FWIW I consider it very odd to think of a string with zero length as
being a valid one.

How would you implement this shortening operation, then? Surely
shortening a one-character string by one character would yield the empty
string. But that cannot be, since the empty string is invalid...


Gergo
 
R

Richard Bos

=?ISO-8859-1?Q?Gerg=F6_Barany?= said:
How would you implement this shortening operation, then? Surely
shortening a one-character string by one character would yield the empty
string. But that cannot be, since the empty string is invalid...

The solution is obvious: a one-character string is not a valid string,
either.

Richard
 
M

Mark McIntyre

Making it trivial to prove by induction that there are no valid
strings.

Er, only if your induction process is broken. The same logic
demonstrates that all numbers are equal to zero, and that there are no
humans in the galaxy.
 
A

Alan Balmer

Er, only if your induction process is broken. The same logic
demonstrates that all numbers are equal to zero, and that there are no
humans in the galaxy.

Of course.

It's not the induction process - it's the premise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top