[CXX-1282] collection::name() should not guarantee returned string is null-terminated Created: 22/Mar/17  Updated: 22/Mar/17  Resolved: 22/Mar/17

Status: Closed
Project: C++ Driver
Component/s: API, Documentation, Implementation
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: New Feature Priority: Major - P3
Reporter: J Rassi Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change

 Description   

The current documentation for collection::name() is as follows:

508     ///
509     /// Returns the name of this collection as a view of a null-terminated string.
510     ///
511     /// @return The name of the collection.
512     ///
513     stdx::string_view name() const;

It's generally not appropriate to pass around stdx::string_view objects with annotations of the fact that the underlying string is null-terminated, since this knowledge is hidden from the type system. Documenting to users that this string is null-terminated also limits the ability of authors to add performance optimizations to this function in the future. We should remove this note from our public-facing documentation, and update our implementation to improve clarity where this function is used.



 Comments   
Comment by Githook User [ 22/Mar/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1282 collection::name() shouldn't be doc'd as null-terminated
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/f0b66afc64171f451fbe88089474449f8d0b211a

Comment by David Golden [ 22/Mar/17 ]

I think we can leave this in.

Comment by J Rassi [ 22/Mar/17 ]

david.golden, I've marked this ticket as a minor backwards-breaking change, since it is no longer valid for applications to rely on the property that the return value of this method is null-terminated (as we are removing the relevant guarantee from our documentation). Let me know if you think we should kick this out to "Future API change release" as a result.

Generated at Wed Feb 07 22:02:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.