Hi Terry,

> > Looking at the use of `p', I suggest making that a const too.
>
> I didn't spot this yesterday, but that won't work because p is used as
> a variable within that function.

Have you tried it?  :-)

    int GetDValue(const char *k) 
    {
        char *p = strrchr((char *)k, 'D');
...
        p++;

Yes, I read that before making the suggestion.
`const char *p' means p is a pointer to a char that's const.
It doesn't mean it's a const pointer to a char that can vary,
nor that it's a const pointer to a const char.
The pointer and char can be const or not, giving four variations.
Thus the `p++' should be fine;  it's moving the pointer onto the next
const char.

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2018-02-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to