>Subject: Re: StrNCompare & PalmOS4 (BUG!)
>From: "Ben Combee" <[EMAIL PROTECTED]>
>Date: Wed, 21 Mar 2001 08:30:58 -0600

>"Stringer" <[EMAIL PROTECTED]> wrote in message
>news:42965@palm-dev-forum...
>>
>> >Subject: Re: StrNCompare & PalmOS4
>> >From: [EMAIL PROTECTED]
>> >Date: Tue, 20 Mar 2001 19:02:02 -0800
>> >
>> >This is the expected behavior.  The function accepts "strings" as
>> > parameters. A "string" is a sequence of characters terminated 
>>>by a NULL.
> >
>> >-- Keith
>>
>> BIG BUG!!!!
>>
>> This is a very significant violation from the way strncmp() works.
>>
>> The benefit of the 'N' is that you don't need null terminated strings.
>
>But StrNCompare != strncmp.
>
>It looks like the old StrNCompare became StrCompareAscii and 
>the standard StrNCompare is now a wrapper around the 
>internationalized TxtCompare.

This is a replay of the MemSet problem.   You have a function
with a name that leads experienced programmers to expect a certain
behaviour and then implement different behaviour.

All of us who have programming in C (and C++) for many years have
a reasonable expectation that the string functions containing 'n' and 
taking a length parameter do not need null-terminated strings.

Since you did this on OS4.0, you have actually changed the characteristic
of an existing, and commonly used function.   This will break programs!

I just checked the definition of StrNCompare in the OS3.5 documentation
and it doesn't say that the strings have to be null-terminated.

THIS IS A BUG!

Roger Stringer
Marietta Systems, Inc.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to