Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
detrino
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
30 ms
·
241.
▲
by
detrino
13y ago
His entire rant about resource management is misplaced. It's not that new/delete/pointers are "bad" or retained only for backwards compatibility, they are primitives from which other abstractions are built. I don&#x
242.
▲
by
detrino
13y ago
Notice that you cat test2.c and then compile test.c.
243.
▲
by
detrino
13y ago
Also, any function can be overloaded on rvalue references.
244.
▲
by
detrino
13y ago
This is a very different kind of optimization than the other things you are talking about. This is something that is operating at a high level and potentially has implications that might not be obvious. You are changing the type of somethin
245.
▲
by
detrino
13y ago
There are a number of considerations because the compiler can't prove it in general without augmenting the type system or doing whole-program analysis. Do you allow, but not require, the compiler to do this substitution whenever it can
246.
▲
by
detrino
13y ago
They are poor solutions compared to RAII: leaky abstractions which are non-composable and error prone. Unfortunately, something like C# using is probably the best you can do in a language without clear ownership semantics like C++.
247.
▲
by
detrino
13y ago
This code makes no sense. I think you do not understand C++ very well.
248.
▲
by
detrino
13y ago
Once things have a name and you can take their address they are no longer an rvalue. It would require a much more sophisticated type system to do this automatically (when you pass a reference to another function, does it capture it?). It wo
249.
▲
by
detrino
13y ago
Forcing a function call to handle an exceptional condition when it doesn't know how doesn't really add anything but bloat to your source code (violating DRY). It's interesting the author mentions goto, because without excepti
250.
▲
by
detrino
13y ago
SEEKING WORK - Las Vegas / Remote / Relocation Proficiencies: * Programming Languages: C++ (with emphasis on modern C++11), C#, GLSL, OCaml, Python, Bash * Networking: TCP, UDP * Technologies: OpenGL * Operating
251.
▲
by
detrino
13y ago
The problem is that "all things being equal" never happens because immutable data structures have worse performance if not used in a way that benefits from persistence. IMO, that makes them a poor default.
252.
▲
by
detrino
13y ago
Except the parent did make that claim.
253.
▲
by
detrino
13y ago
It's not so black and white, if you don't actually need multiple versions of a data structure, then you are strictly copying more. There are scenarios where you do want versioning, of course, but this is why its good to have choic
254.
▲
by
detrino
13y ago
Have you profiled the difference? Do you use these containers in places where it matters?
255.
▲
by
detrino
13y ago
The C++ standard places a number of requirements (ordered, stable iterators/references, logarithmic operations) on std::map which really only lines up with balanced binary trees. As another poster pointed out, C++11 introduced std::uno
256.
▲
by
detrino
13y ago
That's just a different algorithm that produces different results than .erase() and has nothing to do with cache.
257.
▲
by
detrino
13y ago
Removal of an element in a vector is definitely O(n), regardless of cache effects.
258.
▲
by
detrino
13y ago
He doesn't really make a case for not using exceptions though. He misuses the term "undefined behaviour", doesn't discuss RAII and doesn't give any concrete examples.
259.
▲
by
detrino
13y ago
I wasn't sure until "Mindy Hiller".
260.
▲
by
detrino
13y ago
Specializing a STL container to void-star is a far cry from what you get with the STL templates. You lose type safety (casts everywhere) and give up the nice value semantics of C/C++ (no vector<some_struct>). Side note: red-black
261.
▲
by
detrino
13y ago
Rich, good looking actor suggests he got to where he is today by working some menial jobs as a teenager, continues to give trite motivational speech where he equates sexiness with intelligence and generosity, suggests the constraints of lif
262.
▲
by
detrino
13y ago
Your technical note is only true for signed integers and unsigned integers are usually the correct types for such counting loops.