Re:A repository of modern C++ code samples curated by the co...
by usefulcat on Tuesday April 07, 2015 @09:14AM
(#9333731)
A suggestion: I would prefer to not have to scroll the code horizontally. C++ tends to be verbose, and so benefits from a wider window/view. Maybe place the intent and description below the sample code?
Re:A repository of modern C++ code samples curated by the co...
by g1236627 on Tuesday April 07, 2015 @11:16AM
(#9334614)
This is indeed an annoying problem. Please either decrease the font size or use 2 or 4 space indentation (without mixing tabs and spaces) or just steal some space from the sides.
Re:A repository of modern C++ code samples curated by the co...
by MichaelGG on Tuesday April 07, 2015 @09:41AM
(#9333896)
You could always put the type in a tooltip on hover for auto or something like that. That way you get modern code style along with how an IDE would handle it. But yeah, there's no pleasing everyone when it comes to verbosity :)
Re:A repository of modern C++ code samples curated by the co...
by tragomaskhalos on Tuesday April 07, 2015 @11:27AM
(#9334709)
Big thumbs up for your stance on auto - eminently sensible. There are instances where "meh, you don't need to worry about the type here" are valid, but if your code is to teach or explain then it needs to be as explicit as it can possibly be.
Edit: that's not to say that there aren't also cases where you should use auto because it is safer than using an explicit type (some integer sizing/signing scenarios spring to mind).
Re:A repository of modern C++ code samples curated by the co...
by santaclaus on Tuesday April 07, 2015 @02:08PM
(#9335883)
Great looking resource, thanks for putting this together. Is there currently a mechanism to request and vote on samples to add? It would be cool if someone could, for example, request a sample on Expression Templates (or whatever), and other users could vote on which existing requested samples are most interesting.
Re:A repository of modern C++ code samples curated by the co...
by sftrabbit on Wednesday April 08, 2015 @06:47AM
(#9339857)
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.
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