Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
BenFrantzDale
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
91.
▲
by
BenFrantzDale
6y ago
It should be std::string’s job to store strings. If people want to perform operations on them, that’s what free functions are for, right? Nobody wants std::string to have hundreds of methods. Tbb is great.
92.
▲
by
BenFrantzDale
6y ago
I understand that it has to be OK for functions to invoke UB if their preconditions aren’t met. And I guess you could have a pointer to this function and thereby want it to exist without ever invoking UB. But to me a function that can’t be
93.
▲
by
BenFrantzDale
6y ago
Is the compiler allowed to refuse to compile UB if it sees it? Clearly it sees it and is optimizing it away; why not just give a compile error?
94.
▲
by
BenFrantzDale
6y ago
> It's all a matter of delivery, really. And never underestimate the power of body language.
95.
▲
by
BenFrantzDale
6y ago
All of the C++ algorithms list complexity guarantees, I believe. This saga stunned me to learn that C doesn’t seem to do this.
96.
▲
by
BenFrantzDale
6y ago
IMO the lack of a complexity requirement is a bug in the C standard. And really it’s a bug in the implementation(s?) too. If it can be done on O(1), shame on library authors for doing it in O(n). If you want programmers to trust library aut
97.
▲
by
BenFrantzDale
6y ago
And if it’s not a bug in glibc, it’s a bug in the C standard for not requiring it to be big-O of the number of varargs.
98.
▲
by
BenFrantzDale
6y ago
This is an open bug in glibc from 7 years ago(!) https://sourceware.org/bugzilla/show_bug.cgi?id=17577
99.
▲
by
BenFrantzDale
6y ago
Deep down, isn't this a bug in `sscanf`? Is there any reason that it should have to be O(N)?
100.
▲
by
BenFrantzDale
6y ago
Hopefully concepts will save us from cryptic error messages.
101.
▲
by
BenFrantzDale
6y ago
We use C++17 to make our professional 3D printers go. We look forward to C++20 features when they become available. We shed a few hundred lines of code when we upgraded to 17 because we could drop hand-rolled stuff. It works. Nothing is mea
102.
▲
by
BenFrantzDale
6y ago
Well put. I wish more features were rolled out as core language features before putting them in std. making things language features makes them possible. Making them library features makes them vocabulary. I’m more eager for things to be po
103.
▲
by
BenFrantzDale
6y ago
The state is allowed to be heap-allocated but can be optimized onto the stack. But if it calls recursively without control flowing back out again, then I’d think the nested state could live on the stack so long as the compiler knows the nes
104.
▲
by
BenFrantzDale
6y ago
I know the history, but I still think your comment was lumping them together unfairly in this context. With few exceptions, if you are writing `new` or `delete` you are doing C++ wrong in 2021 and that I would call C/C++ :-)
105.
▲
by
BenFrantzDale
6y ago
It's a big deal because, while it has some downsides, being stalkless means they can have next to no overhead, meaning it can be performant to use coroutines to write asynchronous code for even very fast operations. The example given
106.
▲
by
BenFrantzDale
6y ago
Got it. Although I’m not sure what “no overhead” means if the instances have to live way far away on the heap. That means you’ve got an alloc (including a mutex lock), then the value lives far away, then the garbage-collection overhead then
107.
▲
by
BenFrantzDale
6y ago
If in 2021 you think of “C/C++” as a single language, you are missing out on the last decade of C++.
108.
▲
by
BenFrantzDale
6y ago
But are those two variants held in memory inside Sum or are they heap-allocated sitting out on some other cache line? Can one write a performant Sum type?
109.
▲
by
BenFrantzDale
6y ago
That Go doesn’t have the equivalent of `std::lower_bound` is pretty ridiculous.
110.
▲
by
BenFrantzDale
6y ago
Also, if it’s not clear, within a coroutine, you can call any function (or coroutine) you want. It’s just that to co_yield, you have to be in the coroutine not deep in the stack.
111.
▲
by
BenFrantzDale
6y ago
People keep saying C is fast. It’s not. You can’t write a reusable fast sort in C. C++’s std::sort will trounce qsort any day of the week because qsort uses function pointers that can’t be inlined. Without inlined generic algorithms, how ca
112.
▲
by
BenFrantzDale
6y ago
I’ve seen elevators labeled that way!
113.
▲
by
BenFrantzDale
6y ago
You can use pmr and then do no allocation in std containers.
114.
▲
by
BenFrantzDale
6y ago
What is it with “X written in Go”?
115.
▲
by
BenFrantzDale
6y ago
And then there’s ranked-choice voting to vote yes on too! Lots of good reasons to vote in MA this year!
116.
▲
by
BenFrantzDale
6y ago
Hopefully not, with modules in C++20 and beyond. Of course, it still will support headers.
117.
▲
by
BenFrantzDale
6y ago
Yes. And in Python I’ve used this: you can just say f = x.dot and then call f(y), which of course is the same as x.dot(y).
118.
▲
by
BenFrantzDale
6y ago
By “I think C++ can do anything Rust can do, and I would like it to be much simpler to use.” I think he’s saying that he knows there’s an issue with the complexity of C++. See his quote “Within C++, there is a much smaller and cleaner langu
119.
▲
by
BenFrantzDale
6y ago
Small suggestion: this should be an `Object` method: ``` obj->Force += obj->Mass * m_gravity; // apply a force obj->Velocity += obj->Force / obj->Mass * dt; obj->Position += obj->Velocity * dt; obj->Fo
120.
▲
by
BenFrantzDale
6y ago
Well said. As a C++ programmer I always find Go rubs me the wrong way. Like they want to make my life difficult. I think you hit the nail on the head that it feels condescending. My visceral reaction to not being able to write a standard li
More ›