Re: C (functional programming) VS C++ (object oriented programming)
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Thu, 04 Oct 2007 23:15:06 +0530
jacob navia wrote:
santosh wrote:
jacob navia wrote:
Richard Heathfield wrote:
jacob navia said:Heathfield
H. is arguing that strncmp is not a string comparison function.
That's right.[snip]
Yes, I agree that it's a comparison function. So what?OK. I give up.
Are you really saying you don't know the difference between a comparison
function and string comparison function?
The crucial difference between strcmp and strncmp is that the former
_needs_ it's arguments to be null-terminated strings while the latter
doesn't. There is a crucial difference between an array of characters,
(which needn't, but could be, a string), and a string.
Look:
1) The standard names EXPLICITELY strncmp a "comparison functions" in
the section String handling.
2) strncmp starts with the prefix "str"
3) Contrary to memcmp, strncmp will STOP the comparison at a zero byte,
i.e. it has STRING SEMANTICS!
Yes, but it doesn't _require_ it's arguments to be strings.
But you go on telling that it is not a string comparison function.
At the very least I'd say it's a sub-string comparison function.
<snip>
.
- Follow-Ups:
- Re: C (functional programming) VS C++ (object oriented programming)
- From: jacob navia
- Re: C (functional programming) VS C++ (object oriented programming)
- References:
- C (functional programming) VS C++ (object oriented programming)
- From: Joe Mayo
- Re: C (functional programming) VS C++ (object oriented programming)
- From: jacob navia
- Re: C (functional programming) VS C++ (object oriented programming)
- From: santosh
- Re: C (functional programming) VS C++ (object oriented programming)
- From: jacob navia
- Re: C (functional programming) VS C++ (object oriented programming)
- From: santosh
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Heathfield
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Ben Pfaff
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Heathfield
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Keith Thompson
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Heathfield
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Charlie Gordon
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Weeks
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Tor Rustad
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Heathfield
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Tor Rustad
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Heathfield
- Re: C (functional programming) VS C++ (object oriented programming)
- From: jacob navia
- Re: C (functional programming) VS C++ (object oriented programming)
- From: Richard Heathfield
- Re: C (functional programming) VS C++ (object oriented programming)
- From: jacob navia
- Re: C (functional programming) VS C++ (object oriented programming)
- From: santosh
- Re: C (functional programming) VS C++ (object oriented programming)
- From: jacob navia
- C (functional programming) VS C++ (object oriented programming)
- Prev by Date: Re: Reverse word order to read it from right to left
- Next by Date: strftime with format string %x
- Previous by thread: Re: C (functional programming) VS C++ (object oriented programming)
- Next by thread: Re: C (functional programming) VS C++ (object oriented programming)
- Index(es):
Relevant Pages
|