HNHacker News
TopNewBestAskShowJobs

sftrabbit

39 karma · joined September 19, 2014

submissionscomments
sftrabbit··on A repository of modern C++ code samples curated by the community
Thanks. I tried testing on as many devices as I could. Could you please submit a screenshot and description to the website issues page [0]?

[0] https://github.com/sftrabbit/CppSamples-Web/issues

sftrabbit··on A repository of modern C++ code samples curated by the community
The current system is just to post sample suggestions to the GitHub issues page [0]. No voting however. I'm not sure there's much need for a voting system right now.

[0] https://github.com/sftrabbit/CppSamples-Samples/issues

sftrabbit··on A repository of modern C++ code samples curated by the community
I will make sure this is made clear in the sample descriptions.

Experimental means that it's part of Technical Specification - basically the proving ground before being accepted into the C++ standard. It is truly cutting edge stuff, so should only be used where there would not be drastic consequences if it were to suddenly change or disappear.

sftrabbit··on A repository of modern C++ code samples curated by the community
The samples are all very short and generic, so I'm not sure how legal significance a copyright license will have. However, I do plan to add a license to the repository if only to make it clearer.

Is CC0 appropriate for code? I was thinking of going with MIT, but that would require retaining the license in any derivative works. Anybody have thoughts on this matter?

sftrabbit··on A repository of modern C++ code samples curated by the community
Very true, and the site will be a little less useful for those people. I am also planning to add a note to every sample stating which standard it depends on, which should make this problem a bit better.
sftrabbit··on A repository of modern C++ code samples curated by the community
I need to add a license to the samples repository (license suggestions welcome). The samples are all so short and generic that I'm not sure what legal significance it would actually have, but it's worth doing anyway if only to promote sharing and contributions.
sftrabbit··on A repository of modern C++ code samples curated by the community
My biggest concern with Googling for these things is that the Stack Overflow answers range from bad practices, to good C++03 practices, to good C++11/14 practices. It's difficult to know exactly what the state-of-the-art is.
sftrabbit··on A repository of modern C++ code samples curated by the community
Creator of the site here. Thanks for taking a look and I really appreciate all the feedback.

I wanted to provide a place for beginners to learn about modern features of C++ and a quick reference for idioms and best practices. As the disclaimer says, the existing samples all need review, so don't take anything as gospel. If you would like to contribute please check the samples GitHub repo [0] or leave comments on the sample pages themselves.

A few good points that keep coming up:

- The Rule of Three sample especially needs a rework (it will become the Rule of Five later today).

- It isn't supposed to demonstrate the best C++ formatting style, simply because that would come down to personal preference.

- I have opted to not use `auto` unless necessary for the sake of being explicit about types so that beginners have something to reference against. This is important regardless of ones particular preference for when `auto` should be used and it would be impossible to please everybody. I will be adding a note to the site soon.

- I plan to add a "requirements" section to the sample information which will state which version of C++ the sample depends on.

[0] https://github.com/sftrabbit/CppSamples-Samples

sftrabbit··on C++ sequenced-before graphs
You can have values that don't belong to objects. I consider there to be three types of value computations:

- The value computations of operators, like 5 + 6. These don't use the values of objects. They just use the values of their operands. The operands may be subexpressions that denote objects (like 5 + x), but it is the value computation of those subexpressions that uses the object's value, not the value computation of the operator.

- The value computations of expressions denoting objects where the expression is being used as an lvalue. These also don't use the values of objects - they only care about the object's storage location. I give an example in the article, which is the left operand of =.

- The value computation of expressions denoting objects where the expression is being used as an rvalue. This means lvalue-to-rvalue conversion is performed, which is conceptually "reading an object's value out of memory". This, therefore, uses the value of the object.

sftrabbit··on C++ sequenced-before graphs
Author here - Apologies, I'll work on making that better. It could perhaps do with an intermediate step where the expression is broken down into a subexpression tree.
sftrabbit··on C++ sequenced-before graphs
Author here - absolutely! This is only for those with an interest in the details of C++ evaluation. Considering the number of times I see these expressions in a purely theoretical context, I assume many people are at least intrigued.