[cfe-dev] searching for an empty string in an empty string

Tomasz Mikolajczyk tmmikolajczyk at gmail.com
Wed Jun 3 14:16:39 PDT 2015


Hi Vladimir,

It is already a few years that I do not work for that company and I do not
remember the exact version of the product. I think it was sunpro either 11
or 12. Also it may depend on the underlying std library you use. I remember
that the default one - the rogue wave implementation (
http://docs.roguewave.com/legacy-hpp/stdref/) had some serious issues and
it was necessary to switch to stlport (there was a dedicated compiler
flag). I think that stlport was returning npos as a result of such
searching.

Regards,
Tomek

On Wed, Jun 3, 2015 at 8:38 PM, Vladimir Voskresensky - Oracle <
vladimir.voskresensky at oracle.com> wrote:

>
> On 06/ 2/15 05:51 PM, Tomasz Mikolajczyk wrote:
>
> Hi,
>
> What should be the value of a pos variable in the following piece of code?
>
> auto pos = std::string().find("");
>
>  I couldn't find answer to that and noticed it varies between standard
> library implementations. For most I've checked pos is 0 (libstdc++, libcxx,
> msvc). I noticed it is npos for Oracle Solaris SunPRO. I think that both
> results are explainable. Is it an UB?
>
> In the latest SunPRO 12.4 pos is 0 as well.
>
> Vladimir.
>
>
>  Regards,
> Tomek
>
>
> _______________________________________________
> cfe-dev mailing listcfe-dev at cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150603/d34fbe05/attachment.html>


More information about the cfe-dev mailing list