HNHacker News
TopNewBestAskShowJobs

bstamour

303 karma · joined July 19, 2013

submissionscomments
bstamour··on What can we learn from how compilers are designed?
So virtual function overloading?

Can you give a small bit of sample code to demonstrate what you mean?

bstamour··on What can we learn from how compilers are designed?
Ah gotcha. Yes in the current situation we can do nearly everything that the concepts proposal for C++20 does with enable_if, void_t, and a few other helpers. Though concepts have the benefit of letting you "say what you mean", instead of relying on template magic.
bstamour··on What can we learn from how compilers are designed?
Concepts are also C++20. They were voted in, however, shortly after 17 shipped.
bstamour··on What can we learn from how compilers are designed?
C++ doesn't have multiple dispatch. I think the OP was referring to multiple inheritance, which is not the same thing.
bstamour··on Granular Audio Synthesis
That's interesting, and a bit counter-intuitive IMO. But I guess that's why we measure things. The reserve operation is essentially just a single reallocation, whereas the resize is a reallocation plus a bunch of zeroing out. Strange.
bstamour··on Granular Audio Synthesis
One other minor nitpick: know the difference between vector.resize vs vector.reserve. If all you're doing is copying new data into the vector after sizing it, use reserve. This avoids default-constructing all of the values inside of it, only to overwrite them with the new values you're copying in. In the case of primitive types it's probably not a big deal, but it's still doing a second pass over the data just to set it to zero before copying the contents of the file.
bstamour··on Implementing a Gaussian Naive Bayes Classifier in Python
It doesn't make sense, in my opinion (though I could be ignorant). For classification, wouldn't it be better to stick to discrete probability mass functions?
bstamour··on There's a Persistent Hum in Windsor, Ontario, and No One Knows Why
This has been going on for a lot longer than the current US government. Chances are high it's just Zug Island, which contains blasting furnaces for steel and whatnot. The problem is that Zug Island is a part of Michigan, while Windsor is a Canadian city, so investigation is pretty difficult.
bstamour··on Outperforming LAPACK with C++ metaprogramming
Hopefully that will be fixed in a future C++ standard. There is an interesting static reflection proposal floating around that would allow for this, plus more.
bstamour··on How to Run Your Own Mail Server (2017)
Me too. Sendmail and his friends did unspeakable things to me.
bstamour··on Neopets HTML Guide
I remember HTMLGoodies. Before coming across it I learned the basics from a site called Lissa Explains [0].

[0] http://www.lissaexplains.com/

bstamour··on Ask HN: CS and programming books of 2017
Fundamental Proof Methods in Computer Science, by Konstantine Arkoudas and David Musser.
bstamour··on C++17 Standard Published
When C++11 came out, I bought the ANSI copy (identical to the ISO one except for the front page if I remember correctly) for $30. It sure beat the ISO version in terms of price.
bstamour··on What Is a Computational Essay?
I wrote my master's thesis in literate haskell. It was cool to watch the same source material generate either a program or a dissertation, depending on what processor I sent it through.
bstamour··on Peter Thiel sells most of remaining Facebook stake
What if you're selling something that they gave to you as a gift?
bstamour··on The Shortest Papers Ever Published (2016)
My supervisor's thesis from the 70's is in about as good as shape as the one linked. Must depend on when it was scanned.
bstamour··on Ask HN: What tech were you convinced would take the world by storm but didn't?
xhtml: it's just a good idea, IMO.
bstamour··on The Church of the SubGenius Finally Plays It Straight
Yep! It runs on all of my personal gear for that exact reason. Praise Bob!
bstamour··on Teach Yourself C in 24 Hours (1997)
The languages, idioms, and ecosystems are different enough that I don't see that as a problem. They should be treated like two different languages. You wouldn't read a C book and expect to understand the conventions of C#. Neither should you for C++.
bstamour··on Ill-Advised C++ Rant, Part 2 (2016)
Unfortunately yes. The implementation is straight forward though:

    template <typename Container>
    std::size_t size(Container const& c) { return c.size(); }

    template <typename T, std::size_t K>
    std::size_t size(T (&)[K]) { return K; }
bstamour··on Ill-Advised C++ Rant, Part 2 (2016)
Or use the std::size free function. It's overloaded to work with C-style arrays.
bstamour··on Haskell Typeclasses vs. C++ Classes
They've been voted into C++20! The wait may finally be over (in a few more years) :-)
bstamour··on What Monoids teach us about software
It's a simple concept that appears all over in computing. I'm not surprised that that's the case.
bstamour··on What Monoids teach us about software
At least in C++, knowing your type forms a monoid with your operation informs you when you are safe to use various parallel algorithms. e.g. `std::accumulate` with an associative operator is safe to run in parallel.
bstamour··on C++17 is formally approved
Nope, but they are in the pipe. Maybe we'll see them for C++20.
bstamour··on Comparing C and C++ usage and performance with a real world project
Access control rules are all checked at compile time. There's literally nothing to store. If you want proof, check the output of your compiler. The only thing a non-virtual struct/class might do is reorder member variables if they're of different access controls, but if you're just using a C-style struct but with private member variables and public non-virtual member functions, it has literally the same memory layout as it would in C.
bstamour··on Comparing C and C++ usage and performance with a real world project
Unless you explicitly type `virtual`, your C++ classes will have the exact same overhead as C structs. Even with inheritance. The memory layout of

    struct A { int x; };
    struct B : A { int y; };
is the same as if you had written

    struct B { int x; int y; };
Public/private/protected inheritance and access control do not add overhead. It's literally only if you opt in by typing `virtual` do you get class hierarchy overhead.
bstamour··on Parametric Study of a Genetic Algorithm (2003) [pdf]
If you have the horsepower to test a population of deep nets, then absolutely.
bstamour··on Parametric Study of a Genetic Algorithm (2003) [pdf]
Genetic algorithms and the like are still useful for various combinatorial search problems. Not everything can be mapped to a smooth function, and so there will always be (in my opinion at least) room for metaheuristics.
bstamour··on Ask HN: What books are you currently reading?
I'm reading this right now as well. The last time I read it I was still in grade school, and it started my love of science fiction.
← PreviousPage 2 of 5Next →