Re: Null-terminated strings: the final analysis.
- From: Mark McIntyre <markmcintyre@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 12 Apr 2009 20:47:35 +0100
On 12/04/09 20:16, Mark Wooding wrote:
Joe Wright<joewwright@xxxxxxxxxxx> writes:
I believe strings can contain tabs, and other things that don't print but I
agree strings cannot contain the NUL character.
... by a trivial consequence of C's definition of a string, no less.
Exactly - definitionally.
Further, a text file is corrupted by the NUL character in a line.
Only because C strings can't represent lines of text containing a zero
byte.
Again we're into definitions: my definition of a text file is one that doesn't contain non-alphanumeric characters. So if you send a null into such a file, its corrupted.
Using this to justify C's representative inadequacy is circular.
But then so is the counter-argument that is being made. C defines a string as a null-terminated array of characters, therefore its circular to complain that a string can't contain a null.
And anyway, if you want char arrays containing nulls, C can do those, no problem.
--
Mark McIntyre
CLC FAQ <http://c-faq.com/>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
.
- Follow-Ups:
- Re: Null-terminated strings: the final analysis.
- From: Ben Pfaff
- Re: Null-terminated strings: the final analysis.
- From: Keith Thompson
- Re: Null-terminated strings: the final analysis.
- References:
- Re: Null-terminated strings: the final analysis.
- From: Tony
- Re: Null-terminated strings: the final analysis.
- From: Mark McIntyre
- Re: Null-terminated strings: the final analysis.
- From: Mark Wooding
- Re: Null-terminated strings: the final analysis.
- From: CBFalconer
- Re: Null-terminated strings: the final analysis.
- From: Joe Wright
- Re: Null-terminated strings: the final analysis.
- From: Mark Wooding
- Re: Null-terminated strings: the final analysis.
- Prev by Date: Re: Portability regarding sizeof() function
- Next by Date: Re: Portability regarding sizeof() function
- Previous by thread: Re: Null-terminated strings: the final analysis.
- Next by thread: Re: Null-terminated strings: the final analysis.
- Index(es):
Relevant Pages
|