Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > about string and character

Reply
Thread Tools

about string and character

 
 
Chris Dollin
Guest
Posts: n/a
 
      11-26-2007
santosh wrote:

> In article <fibrpm$mco$(E-Mail Removed)1.ov.home.nl>, Harald van D?k
> <(E-Mail Removed)> wrote on Sunday 25 Nov 2007 6:32 pm:
>
>> On Sun, 25 Nov 2007 12:32:13 +0000, Harald van D?k wrote:
>>> On Sun, 25 Nov 2007 14:47:18 +0530, santosh wrote:
>>>> It was fine when Harald started posting to this group, but for a few
>>>> months now, his name has not been displayed properly.
>>>
>>> Apparently KNode encoded my name in utf-8, but Pan encodes it in
>>> iso-2022-kr. I'll check if there's an option to change that.

>>
>> Does it display better like this?

>
> Yes. It is now displayed correctly.


Here too.

--
Echo Hedgehog
Nit-picking is best done among friends.

 
Reply With Quote
 
 
 
 
Harald van Dijk
Guest
Posts: n/a
 
      11-26-2007
On Mon, 26 Nov 2007 07:48:23 +0000, Chris Dollin wrote:
> santosh wrote:
>> In article <fibrpm$mco$(E-Mail Removed)1.ov.home.nl>, Harald van D?k
>> <(E-Mail Removed)> wrote on Sunday 25 Nov 2007 6:32 pm:
>>> On Sun, 25 Nov 2007 12:32:13 +0000, Harald van D?k wrote:
>>>> On Sun, 25 Nov 2007 14:47:18 +0530, santosh wrote:
>>>>> It was fine when Harald started posting to this group, but for a few
>>>>> months now, his name has not been displayed properly.
>>>>
>>>> Apparently KNode encoded my name in utf-8, but Pan encodes it in
>>>> iso-2022-kr. I'll check if there's an option to change that.
>>>
>>> Does it display better like this?

>>
>> Yes. It is now displayed correctly.

>
> Here too.


Thanks all for the information.
 
Reply With Quote
 
 
 
 
pete
Guest
Posts: n/a
 
      11-26-2007
Richard wrote:
>
> Barry Schwarz <(E-Mail Removed)> writes:
>
> > On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
> > http://www.velocityreviews.com/forums/(E-Mail Removed) (Kenny McCormack) wrote:
> >
> >>In article <(E-Mail Removed)>,
> >>(E-Mail Removed) <(E-Mail Removed)> wrote:

> >
> > snip
> >
> >>>This string "0" consists of two characters. The only string that
> >>>consists of a single char is "".
> >>
> >>strlen() and common sense say otherwise. You are confusing how big
> >>something is with how much space it takes to store it.
> >>They are rarely
> >>the same thing, and the later is usually greater than the former.

> >
> > And you are refusing to accept the definition in the standard. From
> > para 7.1.1-1: "A string is a contiguous sequence of characters
> > terminated by and including the first null character."

>
> And you are refusing to understand what KM said. There is a difference
> between the length of a string and the space needed to store it. As is
> clear from this thread and has been true since the day C was invented.
>
> Length is analogous to "how many character do you display in the real
> world" whereas "size" is "how much storage space do you need".


A null byte in an object, is a string.
A null byte consists of one character.

--
pete
 
Reply With Quote
 
Barry Schwarz
Guest
Posts: n/a
 
      11-27-2007
On Sun, 25 Nov 2007 19:31:12 +0100, Richard <(E-Mail Removed)> wrote:

>Barry Schwarz <(E-Mail Removed)> writes:
>
>> On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
>> (E-Mail Removed) (Kenny McCormack) wrote:
>>
>>>In article <(E-Mail Removed)>,
>>>(E-Mail Removed) <(E-Mail Removed)> wrote:

>>
>> snip
>>
>>>>This string "0" consists of two characters. The only string that
>>>>consists of a single char is "".
>>>
>>>strlen() and common sense say otherwise. You are confusing how big
>>>something is with how much space it takes to store it. They are rarely
>>>the same thing, and the later is usually greater than the former.

>>
>> And you are refusing to accept the definition in the standard. From
>> para 7.1.1-1: "A string is a contiguous sequence of characters
>> terminated by and including the first null character."

>
>And you are refusing to understand what KM said. There is a difference
>between the length of a string and the space needed to store it. As is
>clear from this thread and has been true since the day C was invented.


The original message that started this thread did not mention length.
It simply asked "what is the difference between a single character and
a string consisting only one character". In this context,
lovecreatesbeauty's answer is exactly correct. There is only one
possible string consisting of a single character. KMcC chose to
debate the point. He is wrong.

>
>Length is analogous to "how many character do you display in the real
>world" whereas "size" is "how much storage space do you need".


All possibly true but not related to the issue under discussion. If
the OP had asked what is the difference between a single character a
string of length one, the thread would have gone in a completely
different direction.


Remove del for email
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      11-27-2007
Chris Dollin wrote:

> The nul terminator isn't one of the characters "in" a string.


That's just completely wrong.
The standard says that the null byte is part of the string.
The number of participants in this thread
who know what a string is, is dissappointingly small.

--
pete
 
Reply With Quote
 
Chris Dollin
Guest
Posts: n/a
 
      11-27-2007
pete wrote:

> Chris Dollin wrote:
>
>> The nul terminator isn't one of the characters "in" a string.

>
> That's just completely wrong.


No ...

> The standard says that the null byte is part of the string.


.... yes. (Did you miss my earlier post?)

> The number of participants in this thread
> who know what a string is, is dissappointingly small.


It's not to do with what a string "is". It's to do with the meaning
of the term "character in a string". The blindingly obvious [1]
meaning of "the string S contains the character C" and the meaning
implied by the Standard are not the same; this is an interesting
fact, but it doesn't make the obvious meaning "completely wrong".

[1] To me; viz, C is in S if C == S[i] for some i in 0 .. strlen(S) - 1.

--
Chris "fencepost" Dollin

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

 
Reply With Quote
 
Joe Wright
Guest
Posts: n/a
 
      11-28-2007
pete wrote:
> Chris Dollin wrote:
>
>> The nul terminator isn't one of the characters "in" a string.

>
> That's just completely wrong.
> The standard says that the null byte is part of the string.
> The number of participants in this thread
> who know what a string is, is dissappointingly small.
>

char str[] = "Hello";
The sizeof str is 6 while strlen(str) is 5.
While the nul is of type char it's not really a character, is it?

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      11-28-2007
In article <(E-Mail Removed)>,
Joe Wright <(E-Mail Removed)> wrote:
>pete wrote:
>> Chris Dollin wrote:


>>> The nul terminator isn't one of the characters "in" a string.


>> That's just completely wrong.
>> The standard says that the null byte is part of the string.
>> The number of participants in this thread
>> who know what a string is, is dissappointingly small.


>char str[] = "Hello";
>The sizeof str is 6 while strlen(str) is 5.
>While the nul is of type char it's not really a character, is it?


Yes, it really is a character.

C89 2.2.1 Character Sets

A byte with all bits set to 0, called the null character, shall
exist in the basic execution character set; it is used to terminate
a character string literal.
--
"I was very young in those days, but I was also rather dim."
-- Christopher Priest
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      11-28-2007
Chris Dollin wrote:

> The blindingly obvious [1]
> meaning of "the string S contains the character C" and the meaning
> implied by the Standard are not the same;


I prefer to use the C standard's definitions
for terms when discussing C in the C newsgroup.

--
pete
 
Reply With Quote
 
Chris Dollin
Guest
Posts: n/a
 
      11-28-2007
pete wrote:

> Chris Dollin wrote:
>
>> The blindingly obvious [1]
>> meaning of "the string S contains the character C" and the meaning
>> implied by the Standard are not the same;

>
> I prefer to use the C standard's definitions
> for terms when discussing C in the C newsgroup.


And hence it is useful to know that "The blindingly obvious [1]
meaning of "the string S contains the character C" and the meaning
implied by the Standard are not the same."

--
Chris "certainly it's useful to /me/" Dollin

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert string with control character in caret notation to realcontrol character string. Bart Vandewoestyne C Programming 8 09-25-2012 12:41 PM
FAQ 4.31 How can I split a [character] delimited string except when inside [character]? PerlFAQ Server Perl Misc 0 01-25-2011 05:00 AM
How can I replace all occurrences of a character with another character in std string? herman C++ 5 08-30-2007 09:05 AM
8 bit character string to 16 bit character string Brand Bogard C Programming 8 05-28-2006 05:05 PM
getting the character code of a character in a string Velvet ASP .Net 9 01-19-2006 09:27 PM



Advertisments