Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
bstamour
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
1.
▲
by
bstamour
4y ago
... I think the perl code actually compiles (err, runs) though. :-)
2.
▲
by
bstamour
4y ago
I used arch around 2008 or so, then distro-hopped to Slackware, when I remain to this day. Some of us escape.
3.
▲
by
bstamour
4y ago
They actually ship three different cans - one for each firewall in the base install.
4.
▲
by
bstamour
5y ago
You're right. Lambdas in C++ are syntactic sugar over something the core language has allowed you to do since before C++98. Since you control which variables you capture into the closure, and how, when writing the lambda, all of the in
5.
▲
by
bstamour
5y ago
Internally, lambdas are structs with the "function call" operator overload. Context is done via members of the struct: capture by-value, and the struct copies them and stores its own, capture by reference, and the struct member is
6.
▲
by
bstamour
5y ago
I still use it on my primary desktop computer at home. It's a great, stable system that just keeps on running and doing what it needs to do.
7.
▲
by
bstamour
6y ago
Slackware. I use the Plasma5 packages maintained by Eric Hameleers, and it's a wonderful experience.
8.
▲
by
bstamour
7y ago
We use Delphi for some of our older applications (everything new is migrating to either C++17 or Go). I remember upgrading the IDE (forget which version, but it was about 3 years ago) and after loading my project, I hit F1 to bring up the h
9.
▲
by
bstamour
7y ago
Lock guard has no default constructor, so the line will in fact materialize a temporary lock guard around the mutex m, then throw it away at the semi-colon, thus locking nothing.
10.
▲
by
bstamour
7y ago
You can add a literal operator: auto operator "" _r(char const* str, unsigned long) { return std::regex{str}; } To avoid all the backslashes, you can use a raw string literal: int main() { auto myre
11.
▲
by
bstamour
7y ago
Concrete example: void foo(const int* const p1, int* const p2) { int a = *p1; *p2 += 42; int b = *p1; return a == b; // b = a + 42 } int main() { int x = 0; return foo(&x, &x); }
12.
▲
by
bstamour
7y ago
You're right, but what I meant about it was that just because the variable is const, doesn't mean it can't change from somewhere else between reads. Even if you use synchronization to avoid data races, if you read the pointer
13.
▲
by
bstamour
7y ago
If the initial object itself isn't const, then merely declaring the function parameter as a pointer to const won't guarantee that some other thread of execution won't change the value under your nose. Or if you have multiple
14.
▲
by
bstamour
7y ago
readonly was the original proposed name, if I remember my D&E [0] correctly. Bjarne outlined in that book why he went with const instead, but I forget why off the top of my head. I guess it's tine for a re-read! [0] The Design and
15.
▲
by
bstamour
7y ago
The examples in the articles are non-constant pointers to constant data. If you want to declare the pointer itself const, you need to do it after the asterisk. const int* const instead of const int*
16.
▲
by
bstamour
7y ago
Lufia 2 is one of my absolute favourite SNES-era RPG's. I try to replay it every few years.
17.
▲
by
bstamour
8y ago
But in languages that support multiple dispatch at the language level, they're just another way of writing polymorphic functions. They're not just a niche feature. When you don't have to write all of the ceremony of the visit
18.
▲
by
bstamour
8y ago
Why have functions and control structures when we can just jmp?
19.
▲
by
bstamour
8y ago
Very cool. There should be an arrow from Simula to C++ though, as that's where C++ got its object oriented features from.
20.
▲
by
bstamour
8y ago
The dialect of object orientation that Delphi compiles is different than object pascal. It's pretty safe to call Delphi a language.
21.
▲
by
bstamour
8y ago
Boost came about from a few members of the ISO C++ committee as a way to iterate on library features. It would be a shame if none of that work made it's way back into the standard.
22.
▲
by
bstamour
8y ago
I love the Graham scan algorithm for computing convex hulls of sets of points. That and the fast exponentiation algorithm, which can be used to compute linear recurrences (e.g. fibonacci) in O(log n) time.
23.
▲
by
bstamour
8y ago
Knuth defines effectiveness as: "... all of the operations to be performed in the algorithm must be sufficiently basic that they can in principle be done exactly and in a finite length of time by a man using paper and pencil." K-m
24.
▲
by
bstamour
8y ago
a % b is a way to do it in fewer iterations than a - b.
25.
▲
by
bstamour
8y ago
It's an example of uniform initialization syntax that was brought into the language in C++11. It simplifies some things (no narrowing conversions allowed) but also complicates things (if any constructor takes in an initialize-list, it
26.
▲
by
bstamour
8y ago
> I adore Zodiac as well but am in a decided minority in that regard. We're in the same camp, friend. Zodiac was my favourite novel of his.
27.
▲
by
bstamour
8y ago
Have you looked at Perl 6? It's optionally typed, and can be nearly as terse as apl with some of it's higher order operators.
28.
▲
by
bstamour
8y ago
Verbing weirds language. Respect your parts of speech!
29.
▲
by
bstamour
8y ago
No it won't. You'll get a compile time error, as T could either deduce to int or double. Unless you explicitly specify it as max<int>(1, 2.0) or max<double>(1, 2.0).
30.
▲
by
bstamour
8y ago
C++'s type system has always been stricter than C's. Even the following, totally valid C program, is ill-formed C++ int* x = malloc(5 * sizeof (int)); because in C++ you cannot implicitly cast a void pointer.
More ›