| Thanks Steven, that's fine. If I clash with it again, and come undone,
I'll get back to you.
On 31 July 2015 at 14:45, Steven Yi wrote:
> I just read through the strtod opcode's source:
>
> https://github.com/csound/csound/blob/develop/OOps/str_ops.c#L536-L575
>
> and it seems to be doing the right thing to me. I'm going to vote to
> keep the current behavior.
>
> On Fri, Jul 31, 2015 at 7:54 AM, Rory Walsh wrote:
>> It's not the first time I've been caught out with this when working
>> with the API. I'm not sure what's best. Considering Csoud is written
>> in C, perhaps it should go the way of C rather than C++?
>>
>> On 31 July 2015 at 13:47, Steven Yi wrote:
>>> Well the C strtod *does* allow for empty strings and returning 0. Then
>>> again, it also appears to return 0 even with invalid data. I was just
>>> putting out there what benefit the current behavior provides. (In
>>> other words, just wanted to add more information, but not really
>>> voting on one or the other.)
>>>
>>> On Fri, Jul 31, 2015 at 6:41 AM, Rory Walsh wrote:
>>>> I see your point. My work around was to add a preceding 0 to the
>>>> string I'm testing. I guess if this is how the underlying functions
>>>> work, it might be best to have them work in the same way in Csound.
>>>> Case closed.
>>>>
>>>> On 31 July 2015 at 12:32, Steven Yi wrote:
>>>>> Not sure what others think, but that seems reasonable to me. Just for
>>>>> reference, I checked strtod and found:
>>>>>
>>>>> http://www.cplusplus.com/reference/cstdlib/strtod/
>>>>>
>>>>> and it mentions:
>>>>>
>>>>> "If the first sequence of non-whitespace characters in str does not
>>>>> form a valid floating-point number as just described, or if no such
>>>>> sequence exists because either str is empty or contains only
>>>>> whitespace characters, no conversion is performed and the function
>>>>> returns a zero value."
>>>>>
>>>>> I guess the flipside is that the current behavior might be useful to
>>>>> help detect coding errors.
>>>>>
>>>>> On Fri, Jul 31, 2015 at 6:18 AM, Rory Walsh wrote:
>>>>>> This opcode gives an init error when passed an empty string. Can its
>>>>>> behavior be changed so that it returns 0 in the case of empty strings?
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |