HNHacker News
TopNewBestAskShowJobs

jguegant

314 karma · joined March 2, 2015

submissionscomments
jguegant··on C++17 and its Technical Specifications
Here starts the rustwin point.
jguegant··on Why I want Concepts, sooner rather than later
You just reached the Rustwin's point of Hackernews: "As a discussion about C++ or C grows longer, the probability of a comparison involving Rust, as a savior, approaches 1. Afterwards any further discussion is considered null and void".
jguegant··on An introduction to C++'s variadic templates: a thread-safe multi-type map
I yet didn't check the proposal for C++17 concepts, it seems to constantly change since C++11. Does it includes anything related to variadic templates? Anyway, you must have had a lot of fun with Jaakko Järvi as a teacher!
jguegant··on An introduction to C++'s variadic templates: a thread-safe multi-type map
Haskell and C++ look like the "elite" combo these days, especially when it comes to meta-programming and FP as you said! It's funny how these two different communities are mixing. It feels like JavaScript and Ruby having a child.
jguegant··on An introduction to C++'s variadic templates: a thread-safe multi-type map
I see it as a language in itself. Once done with the steep learning curve you start to observe repeated patterns and get it more easily. I do agree that the syntax is a huge drawback from now.
jguegant··on An introduction to C++'s variadic templates: a thread-safe multi-type map
Yes definitely tricky. It might give a heart attack to some high frequency system designers! I will investigate this topic in future: maybe someone can come up with a spin-lock or lock free solution.
jguegant··on An introduction to C++'s variadic templates: a thread-safe multi-type map
Thank your Sir! Sadly C++ drags a bad reputation from its earlier years. I wish my posts make C++ reachable and enjoyable for common guys like me.
jguegant··on An introduction to C++'s variadic templates: a thread-safe multi-type map
As I explained in a commentary: As far as I understand gcc implementation. In a pseudo-code it would be:

Mutex mutexes[SIZE_OF_POOL];

int hash(void* p) { ... }

std::shared_ptr<t> atomic_load( const std::shared_ptr<t>* p )

{

    int r = hash(p);

    lock(mutextes[r % SIZE_OF_POOL]);
    return *p; // Safe copy of p.
}

All the other atomic operations (store, etc) use the same lock pool, so it should be fine for the copy! If you want to take a look at gcc's implementation:

https://github.com/gcc-mirror/gcc/blob/bd3f0a53c07086e978ea4...

https://github.com/gcc-mirror/gcc/blob/bd3f0a53c07086e978ea4...

jguegant··on SourceWeb: A C/C++ source code indexer and navigator
YCM is good for vim too: https://github.com/Valloric/YouCompleteMe

It uses Clang for C/C++/Objective-C/Objective-C++ and exposes itself as a server usable from vim, emacs, sublime ...

jguegant··on The history behind the decision to move Python to GitHub
I have no clue on how to generate a patch. But I did a fair amount of pull requests... It might be a generation problem.
jguegant··on D 2.069.0 released, compiler automatically ported from C++ to D
I have to agree on this. I was surprised to see that a majority of the Rust community actually comes from some web-development domains. Especially when comparing Ruby, a highly flexible dynamic language, to Rust a language full of constraints (for its own valid reasons).

Note that the a hype train is a two-edged sword, it will both bring a strong community and might also induce a cliff with the other communities (praising a single god is never a good thing).

jguegant··on Rust Lifetimes
I am genuinely interested in this. Do you have any good reference about it?
jguegant··on C++'s SFINAE concept: compile-time introspection of a class
It's not really a bug, but a feature standardised in C++11 to avoid unwanted failures with a trailing template somewhere in your code. But this feature was hijacked to do type checks!

Maybe a better example would be a project that mix different libraries with different to convention for their "to string" methods: obj.toString(), to_string(obj), obj.ToString(), obj.to_string()... Which one would you use if you simply want to ouput your object on std::cout? In that case, a type check would be really handy!

jguegant··on Rust Lifetimes
Exactly! No matter the future of Rust, it has already shaken the programming community and motivated the other language designers to catch up in that domain.

As to guess whether Rust will put down C++ forever and ever, is another hard question. It will be a matter of community and sadly money... For instance, Apple's already got a much better market share with Swift (look at the job trends) simply because it's Apple. Same goes for JavaScript greatly helped by Google (V8) for their interest (a faster JavaScript engine ==> better usage of Google's web services).

jguegant··on Rust Lifetimes
One can simply ditch the C++ backward compatible features into an "unsafe" part of C++. That's exactly what the talk given by Herb at the CppConf is trying to address. All the old unsafe part of C++ will trigger errors or warnings. But if truly necessary one will be able to disable these protections!
jguegant··on Comparing Chinese provinces with countries (2011)
The GDP per capita tab is really interesting if you want to estimate the life standard of each province. GDP itself is interesting for the "global power"/influence of each province over another one.
jguegant··on Comparing Chinese provinces with countries (2011)
You can click on the tab: GDP per capita. And there you will see that Guangdong is as rich as kazakhstan.
jguegant··on Memory and C++ Debugging at Electronic Arts [video]
Rust is kinda the Godwin's law of C++ threads these days.
jguegant··on C++ vs. OCaml: Ray tracer comparison (2005)
One can do a ray tracer in O(1) at runtime in C++ ;)

https://github.com/phresnel/metatrace

Performance 100%!

OCaml is a really clean language though!

jguegant··on GitFlow considered harmful
What about using merging when it comes to the feature branches but rebase when pulling (git pull --rebase)? Is it that harmful to rewrite the history for your local changes?
jguegant··on How US students get a university degree for free in Germany
To quote myself: "That's true. And I guess half of them wished they could stay. When people abuse the system, it always destroys the dream of some others. No offences to Chinese people either, their high population just makes them more "visible" when it comes to that kind of problem.

As far as I remember in France if you do a 2 years master's degrees, you have a VISA for 1 year to search for a job. One can even search for part-time jobs during his studies. If you succeed, after 2 years more, you can ask for the French citizenship. But, sadly, it collides with the Chinese policy that rejects double nationalities."

jguegant··on How US students get a university degree for free in Germany
That's true. And I guess half of them wished they could stay. When people abuse the system, it always destroys the dream of some others. No offences to Chinese people either, their high population just makes them more "visible" when it comes to that kind of problem.

As far as I remember in France if you do a 2 years master's degrees, you have a VISA for 1 year to search for a job. One can even search for part-time jobs during his studies. If you succeed, after 2 years more, you can ask for the French citizenship. But, sadly, it collides with the Chinese policy that rejects double nationalities.

jguegant··on How US students get a university degree for free in Germany
I am not saying whether the European system is better or far worse, just explaining why our systems permit free studies easily.

France is clearly lacking of interesting jobs (SII) in IT, expect research maybe. Europe is also far from having a perfect society, but nothing is black or white, just gray.

I was working only few weeks ago in Hong-Kong for the biggest French bank in HFT and had a decent salary as a graduated. Hong-Kong follows the US style. I was asked to move to NY for 1XXk but finally opted for a life in Sweden for many other reasons. Anyway, I did my research about NY. With the 1XXk in NY, you must pay a 3000$ * 12 rent (36k) for a 40m², put 1/3 for a future retirement and in case of a terrible health problem (30k$). When you get children, you must pay everything by your own, like fees for 2 children = 15000$ * 2 (30k$). Plus you work 30% hours more, hence make 30% more per hour. Statistically, Americans are richer, so it must be interesting to move there especially when single. It highly depends on your life style and your expected work-life balance.

jguegant··on How US students get a university degree for free in Germany
French here, the tuitions are close to 0 in Finland and France too (granted that you learn French). Our parents pay up to 50% (I don't have the exact percentage) of various taxes based on their salaries and daily life goods, and we as children will do the same. It makes sense that our government rewards us in some way: health care for free, school for free, retirement... In Europe, the government avoids you to shoot yourself by managing part of your money for the well being of the society. In return, we may look less rich by looking at our bank balance. If you take a 3500 $ Swedish salary with all the taxes applied, your life level might be equivalent as a 7000 $ salary in US.

Beware not to overuse this trick. In the past many other European countries were accessible for virtually free. Until an army of Chineses came, studied for free for 5 years and went back to their hometown without any contribution to the society (taxes, intellectual contributions...). That's why Sweden granted recently the free access to only Europe citizens that anyway pay common taxes in their own country.

jguegant··on A simple UI framework for Rust
Out of curiosity: why the author tends to write "self" at the end of the methods ?
jguegant··on Would Rust have prevented Heartbleed? Another look
Your points are clearly valids. But wouldn't some of them corrected by a strict mode?

- For instance, the reuse of the original variable could be deduced by the compiler. - The bound checking for std::vector can effectively be enable. One could imagine an std::strict_vector that do so.

What I am wondering is: does the same idiomatic memory management applied to C++ would require some huge tweaks to the language, some bad tricks, new keywords, or can it be done without changing its design but enforcing some rules?

I, for instance, have no clues how to deal with your "one unique_ptr two threads" problem. Could it be done in an elegant way in C++?

jguegant··on Would Rust have prevented Heartbleed? Another look
A side question to HN:

For the security topic, most of the power of Rust come from a strong typing, safety checks (boundaries), ownership checks... Well, a lot of checks at compile time.

As far as I know of Rust by glancing at the doc frequently, C++11/14 also contains these "safe tools": ownership can be dealt with smart pointers (unique, shared), value semantics, move semantics (rvalues) and the rest. Boundaries checks with the correct containers (std::vector, std::array...). Mutability with "const". Atomicity with std::atomic... Type safety by using explicit conversions, templates instead of macros, variadic args...

Heck, all the drama from C++ seems to come from a misusage or some legacy parts from another age (up to C). In order to avoid people to shot themselves in their feets, why couldn't we just introduce a strict compilation mode a la JavaScript to let say Clang: # pragma strict

# pragma unsafe # pragma safe

Nowadays, good C++11 compilers can even deal with such a things like constexpr. This seems a reachable goal.

What are the true drawbacks of a fully modern C++ code compared to a Rust? Is there any true feature that can't be done in C++ due to a deep problem of conception? Don't le me wrong, I do not seek to diminished the amazing work of Mozilla. I am not talking neither about the other cool features from functional languages, switch cases... that Rust has and C++ don't.

← PreviousPage 2 of 2