Re: C (functional programming) VS C++ (object oriented programming)



santosh <santosh.k83@xxxxxxxxx> writes:

jacob navia wrote:

Richard Heathfield wrote:
jacob navia said:
H. is arguing that strncmp is not a string comparison function.

Heathfield
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.

This is another example of petty one upsmanship and word twisting. Both
work almost exactly the bloody same. The difference is that ONE of them
specifies the maximum number of characters to compare. Not a huge
difference but potentially a very optimal difference where the first N
characters are the UID of the object in question.

Yes, CLEARLY strmp needs a well formed string and strncmp doesnt.

To accuse someone of not knowing the difference between a comparison
function and a "string comparison" function is, in this case, trite and
petty when one considers that its very obvious that the poster knows
what the functions do.
.



Relevant Pages

  • Re: C (functional programming) VS C++ (object oriented programming)
    ... The crucial difference between strcmp and strncmp is that the former ... (which needn't, but could be, a string), and a string. ... At the very least I'd say it's a sub-string comparison function. ...
    (comp.lang.c)
  • Re: C (functional programming) VS C++ (object oriented programming)
    ... The crucial difference between strcmp and strncmp is that the former _needs_ ... needn't, but could be, a string), and a string. ... But you go on telling that it is not a string comparison function. ...
    (comp.lang.c)
  • Re: C (functional programming) VS C++ (object oriented programming)
    ... 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_ ... needn't, but could be, a string), and a string. ...
    (comp.lang.c)
  • Re: Prothon should not borrow Python strings!
    ... """It does not make sense to have a string without knowing what encoding ... same cul de sac as Python. ... Prothon_String_As_ASCII // raises error if there are high characters ... Python's split between byte strings and Unicode strings is ...
    (comp.lang.python)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... put them in stupid places. ... Programming is difficult (as you must surely appreciate, ... > strings will be in the range 1...1000 characters. ... impose an artificially small limit on string length." ...
    (comp.programming)