Skip to content

Conversation

@husamettinarabaci
Copy link

📄 Description

This PR adds content to the previously empty "Disadvantages" section of the accepting-strings idiom.

The section outlines the potential trade-offs and caveats when working with &CStr in FFI contexts, including:

  • Lifetime management complexity
  • Null-termination requirements
  • Fallibility of UTF-8 conversions
  • Potential thread safety concerns with raw pointers

These additions aim to give developers a clearer understanding of the limitations and risks, complementing the advantages already described.


🔍 Motivation

The "Disadvantages" section was previously marked as None?. This contribution completes that section with relevant, up-to-date notes based on current Rust FFI practices (as of Rust 1.77+).


✅ Checklist

  • One idiom file changed only (accepting-strings.md)
  • Markdown formatting validated
  • Commit message follows docs: convention
  • No semantic meaning changed in existing content

@simonsan
Copy link
Collaborator

@Michael-F-Bryan @jhwgh1968 Could someone of you give this a look? As initial authors and reviewers, I would love to know your feedback as well. ✊🏽

@simonsan simonsan added C-waiting for Category: Waiting for feedback of the initial author or some external dependency/issue A-idiom Area: Idioms C-amendment Category: Amendments to existing content labels Dec 14, 2025
@jhwgh1968
Copy link
Contributor

Why are these disadvantages specific to the approach recommended? They seem more like "the disadvantages of C strings" instead, and the assumption here is you need to use them for e.g. interoperability with C code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-idiom Area: Idioms C-amendment Category: Amendments to existing content C-waiting for Category: Waiting for feedback of the initial author or some external dependency/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants