Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
safercplusplus
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
31.
▲
by
safercplusplus
2y ago
Yeah. The provided build script produces a DEBUG executable (only). The NDEBUG version isn't tested regularly yet. But performance isn't really an issue, so the NDEBUG version has sort of been de-prioritized in favor of feature co
32.
▲
by
safercplusplus
3y ago
> the easiest path to convincingly make C++ safe is to convincingly make C safe first Yeah, with all the static analysis, I did end up straying from the easy path. Ugh :) But actually, one thing that C++ provides that I found made things
33.
▲
by
safercplusplus
3y ago
Hi pizlonator, I'm working on a solution with similar goals (I think), but a bit of a different approach. It's a tool that auto-translates[1] (reasonable) C code to a memory-safe subset of C++. The goal is to get it reliable enoug
34.
▲
by
safercplusplus
6y ago
Some solutions aren't that well publicized. Here is an example of an open source png encoder/decoder written in C (mostly) being auto-translated to a memory-safe subset of C++: https://github.com/duneroadrunner
35.
▲
by
safercplusplus
7y ago
If you're planning that far ahead it may not be an either-or situation. That is, in the future C/C++ may also have an enforced memory safe subset. In which case the issue becomes, how do you write your code today so that it will c
36.
▲
by
safercplusplus
7y ago
Unfortunately, documentation [1] is still kind of lacking. Like Rust (and arguably modern C++ conventions?), the safe subset doesn't support pointer arithmetic directly. You would have to convert the pointer to an iterator (and its tar
37.
▲
by
safercplusplus
7y ago
I think the answer is yes. There's a complementary project [1] that aims to enforce a slightly more restricted memory safe subset of C++ than the lifetime profile checker does (or eventually will). The restrictions do not manifest as l
38.
▲
by
safercplusplus
7y ago
Counterparts for Rc [1] and Arc [2] (and compiler enforcement of their safe use [3]) are available in C++, though not standard. [1] https://github.com/duneroadrunner/SaferCPlusPlus#reference-c... [2] https://
39.
▲
by
safercplusplus
7y ago
And also one less thing to transfer to the heads of anyone else that might need/want to understand the code. (Often the author him or herself at some point in the future, right?) Though equivalent facilities are available in C++ [1][2]
40.
▲
by
safercplusplus
7y ago
Those interested can check out a (nascent) "borrow checker"[1] for enforcement of C++'s memory and data race safe subset. [1] https://github.com/duneroadrunner/scpptool
41.
▲
by
safercplusplus
7y ago
While not as mature as Rust, static enforcement of C++'s (memory and data race) safe subset is coming along [1]. Iiuc tools like TrustInSoft are for situations where you need not just safety, but "reliability" (i.e. no crashe
42.
▲
by
safercplusplus
7y ago
Presumably a C++ (or SaferCPlusPlus[1] ;) implementation would see a similar cache performance advantage versus C? Also, isn't it unintuitive that branch mispredictions go up with larger batch sizes? Wouldn't there be fewer branch
43.
▲
by
safercplusplus
7y ago
Others disagree, but I suggest that someone could make such a linter. As others point out, the Core Guidelines "lifetime profile checker"[1] is designed to be an advanced static analyzer that restricts how many C++ elements can be
44.
▲
by
safercplusplus
7y ago
> like a weak pointer that work with unique_ptr, but I do not think it is possible to do this while preserving zero overhead implementation I think the type of pointer you're asking for basically does exist. First, you want to disti