-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raw pointers in C++ implementation #410
Comments
I'm not opposed to that but I'm no C++ expert so that will have to be contributed. |
My knowledge of C++ is rather light as well. I would change
But then the use of |
Btw how differ pointers in Nim, Go and Rust from C++ in that struct? Go type RelatedPosts struct {
ID string `json:"_id"`
Tags *[]string `json:"tags"`
Related [topN]*Post `json:"related"`
} Nim RelatedPosts = ref object
`"_id"`: string
tags : ref seq[string]
related: array[N, ptr Post] Rust struct RelatedPosts<'a> {
#[serde(rename = "_id")]
id: &'a str,
tags: &'a [&'a str],
related: Vec<&'a Post<'a>>,
} all three are using pointers for tags array and post.. is it safe approach? |
I think Go's default pointers are managed by GC and are therefore safe. Rust pointers have lifetime I don't know about Nim. |
According to https://nim-lang.github.io/Nim/tut1.html#advanced-types-reference-and-pointer-types, |
cpp and cpp_con ref #410 and zig improvement
Rules says no unsafe code blocks. Raw pointers are what other languages consider unsafe. Since smart pointers are available in modern C++, wouldn't replacing raw pointers with smart pointers make the most sense?
The text was updated successfully, but these errors were encountered: