Talk:cpp/string/basic string/basic string
From cppreference.com
[edit] s==NULL
According to cplusplus.com behaviour of the constructor is undefined if s==NULL in (4) or (5). Can anybody confirm that and add a comment to the page? Does anybody know the reason for s==NULL not resulting in an empty string? --Bear (talk) 05:25, 14 January 2016 (PST)
- we say the same thing, "The behavior is undefined if s does not point at an array of...". A null pointer does not point at an array. The reason is that any function that takes a C string as input, in C or C++ alike, has that precondition (except for the _s functions from the bounds-checked C extension). --Cubbi (talk) 05:55, 14 January 2016 (PST)