Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
bstamour
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
17 ms
·
121.
▲
by
bstamour
12y ago
C++ is indeed a high level language, comparable to, say, C#. Let's enumerate some features that we take for granted in most modern high level languages 1. Type deduction (C++ has it) 2. Lambda functions (C++ has it) 3. Support for OO
122.
▲
by
bstamour
12y ago
And this is why I hate the term "mathematical induction". It's actually a form of deductive reasoning, not inductive reasoning.
123.
▲
by
bstamour
13y ago
You can, but not with vector. Use valarray if you need to perform those kinds of computations.
124.
▲
by
bstamour
13y ago
Make sure to check out the android app too. It's cool to be able to read your self-hosted RSS feeds from your phone with zero hassle.
125.
▲
by
bstamour
13y ago
Is the phrase "locator value" defined by the C standard? I've never heard of it before. I always knew the 'l' in "lvalue" as meaning "this expression can appear on the left-hand side of an assignment
126.
▲
by
bstamour
13y ago
Which goes right back to the original piece of advice: if you have access to the main apache config, put your changes there for performance reasons. Otherwise use .htaccess.
127.
▲
by
bstamour
13y ago
It was mentioned in a section about frameworks: http://jstherightway.org/#frameworks
128.
▲
by
bstamour
13y ago
I omitted the return type (which is allowed for lambdas in C++11, and now arbitrary functions (with some conditions) in C++14) because it was a 1-liner. The bool return type can be deduced by the compiler automatically (or else it would fai
129.
▲
by
bstamour
13y ago
More than that, actually. Because of argument dependent lookup, this will work for any container that has begin and end functions in the same namespace.
130.
▲
by
bstamour
13y ago
With C++14 this becomes sort(begin(vs), end(vs), [](auto const& l, auto const& r) { return l.size() < r.size(); }); Even simpler.
131.
▲
by
bstamour
13y ago
After years of long build times, we C++ programmers basically have to become mental compilers in order to keep our productivity high.
132.
▲
by
bstamour
13y ago
It allows you write code that works for multiple types. For example, consider the following function in C++: template <typename T> T min(T a, T b) { if (a < b) return a; else re
133.
▲
by
bstamour
13y ago
Typically with monadic code, a function with an underscore at the end of its name discards it's effect. For example, the function mapM maps a function over a list, i.e. mapM :: Monad m => (a -> m b) -> [a] -> m [b]
134.
▲
by
bstamour
13y ago
unique_ptr, the default smart pointer in C++ is no slower than direct pointer access. If you require data sharing, then shared_ptr offers you that feature at the cost of reference counting.
135.
▲
by
bstamour
13y ago
It closes for me fine. Just tested it to be sure.
136.
▲
by
bstamour
13y ago
I tend to write a lot of systems-level code, and the reason I choose C++ over C is because C++ gives me more power to build useful abstractions, while still letting me drop down to the bit-twiddling level if I need to. I do enjoy high level
137.
▲
by
bstamour
13y ago
Yes. C++ is one of the few (maybe the only) languages that gives you enough high-level features to be productive, but doesn't do so at the expensive of ruthless runtime efficiency. If you need to squeeze every ounce of juice out of a m
138.
▲
by
bstamour
13y ago
Correct. Even if you simply changed all of your dynamic arrays to std::vectors, the code you write is now simpler, easier to reason about, and pretty much memory leak-free.
139.
▲
by
bstamour
13y ago
It's not an optimization: it's move semantics. And it's default behaviour for any standards-conforming compiler. Moves can be optimized away still, but by default, returning a std::vector from a function is a constant-time op
140.
▲
by
bstamour
13y ago
I wouldn't say it's gone into scripting language territory yet, but C++ is becoming a much simpler language for everyday programming. It's still a large complicated beast with sharp corners, but that only really occurs when y
141.
▲
by
bstamour
13y ago
Passing by value in C++ can offer speed increases when the function will be copying the object anyways, due to move semantics, constructor eliding, etc.
142.
▲
by
bstamour
13y ago
Technically C doesn't have a standard ABI either. Compilers just tend to use similar symbol names.