Namespaces
Variants
Actions

Talk:cpp/string/char traits/find

From cppreference.com

[edit] NULL or zero as the return value?

Seems that it should be 0 or at least nullptr. According the the latest C++ draft in pp 740, section 21.2.1, in the table:

Returns: the smallest q in [p,p+n) such that X::eq(*q,c) is true, zero otherwise.

Emphasis is mine.

Seems to me that we should stick to the Standard, even though we may equal NULL to zero.

ticotico (talk) 10:50, 12 June 2020 (PDT)

I think if you want to be super-precise, it returns the null pointer value of its return type. "zero", "NULL" and "nullptr" are equally distant from that. --Cubbi (talk) 12:19, 12 June 2020 (PDT)