-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add C++ 20 #113
Comments
Probably still needs some time to mature. Out of curiosity: |
Some of the new features in std may help us write more compact code that is easier to read. for example std :: ranges, std :: to_array, std :: span, std :: map :: contains, std :: vector :: erase etc. Maybe that doesn't seem like a big deal, but I'd like to practice, learn and take advantages of the latest available standards. So I will ask the opposite question. Which lack of compiler functionality prevents us from adding C ++ 20 support? |
Ranges can at least be used somewhat with ranges-v3 library: Yeah, such neat methods would be nice. Personally I would like to see the following still missing features:
But then again, for solving problems, they are not that much needed. Also, currently Clang is used for compiling: #42 (comment) All in all, definitively +1 for new version ^^ |
Technically, nothing prevents adding support (maybe the test framework need another patch, but haven't tried yet). I just don't want users to get confused and complain (e.g., "X is in C++20, but doesn't work on Codewars"). Unlike most of the languages with versions that describes the implementation, C++20 is a standard and compilers are still working on it. We show compiler name and version, but users won't look up the compiler support status. That being said, we can add support sometime soon if C++ users think it's ready.
We can use GCC if necessary. I think Clang was chosen because of the better error messages many years ago. As far as I know, GCC got much better. |
Any update here? As the compiler version is known, users can check support for a specific feature. C++ people are aware that C++20 is not fully supported in gcc & clang (MSVS is already feature-complete!) C++20 changes significantly way of writing the code - concepts, ranges, coroutines. Algorithms will look totally different. C++20 is a must-have! As already mentioned, it would be great to have ranges-v3 & fmtlib also available. |
I'm waiting for feedback.
fmt and ranges-v3 are already supported. |
What feedback do you need? There is never too soon to upgrade the compiler :) Compiler support for C++20 features is available here: https://en.cppreference.com/w/cpp/compiler_support/20 . Gcc has better support for ranges so I would vote for switching to gcc. There is no significant difference in error readability nowadays. I don't think you should wait till all features will be implemented. Missing stuff is rather minor, all game-changers (modules, ranges, concepts, couroutines) are there. |
I am sorry, but I missed the notification that you mentioned me. Unfortunately, as you probably noticed, my C++ skills are really rusty (I stopped doing professional C++ a couple of weeks before C++11 got published) and I am completely out of the loop when it comes to compilers, support matrices, most of modern features (modern as in C++11 and newer ;) ) so I have no strong opinion on whether C++20 is good to go or not. The one thing I know I like about C++20 is formatting, improvements to containers ( There are two new members who are very active in area of C++ authoring, I could bring this topic to their attention and see what others think :) |
The difference between C++17 and C++20 is bigger than the difference between C++03 and C++11. It will really make a difference. |
Hello, In my opinion, it would be better to wait a little bit more till compilers fully support C++20, but the current coverage by the most popular compilers is pretty enough to be useful. Though, I wouldn't for example use it in my personal projects yet. |
This issue is still relevant. |
Any update ? |
The ability to use c++20 features would be really helpful |
New Year 2024 is coming soon... |
Being restricted to C++17 makes it hard to use codewars to improve my C++ skills. I want to train good practice of today and the forseeable future, not good practice of 5 years ago that's already deprecated when it comes idiomatic C++. |
When will C++20 be added? |
I'm hoping sometime soon. I started looking into adding C++20 support before the end of the year. Testing with Igloo seems to be working, at least for the very basic tests, but I'm hesitating to continue using it with so many known issues.
Qualified doesn't use Igloo, so code runner currently supports GoogleTest and Criterion for C++ as well.
Catch2 mentioned in #52 is very nice and lightweight, so that's an option too. Obviously, changing the test framework means all the existing kata must be updated manually, so this is not an easy decision to make. What do you guys think? |
Step 1: Create a 1 dan task for a script to migrate kata from one format to another. Even better incentive could be making the obsolete C++ translations untrainable, and encourage the community members to fill the void. Okay, but seriously now: I have never used neither Catch2 nor GoogleTest, so I have no preference. Heck, since custom assertion messages have been added to Snowhouse, the framework is at least bearable. However, what I would really like to get from the update of C++ setup is having snippets as separate translation units, or, ideally, possibility to represent solution snippet and preloaded as a pair of header file + implementation file. Ad amount of kata and backwards compatibility: there's ~1200 C++ kata which would require an update. A lot, but still fewer (by a lot) than amount of kata which require(d) update for JS or Python. I know that update of C++ code would be more complex than JS or Python, but I would estimate the amount of effort as similar, and not much higher. Great effect would be that redoing C++ translations would hopefully help to get rid of really, really many terrible setups and designs: remove terrible requirements for rounding, strict float equality assertions, fix functions with bad or non-idiomatic signatures, adding random tests, improving structure of test cases, adding feedback for failing tests... |
Yeah, we're doing that with GoogleTest. Qualified allows users to create files in the project directory, but also supports the minimal format like Codewars. In that mode, we create If we're making the setup incompatible, there's no reason to keep using Igloo. |
Created https://github.com/codewars/next-cpp to show how the next C++ version may be supported, and to experiment publicly. I haven't had the chance to document it well, but I hope it's clear enough.
I didn't create container images, but you should be able to play with them if you have newish C++ compiler, CMake and Ninja. I'll accept PRs for Dockefiles. Feel free to contribute in any way. Some feedback/help I'm looking for:
|
I do not think you need to worry about these. Currently, in Snowhouse-based kata, the custom stringizers are used for one of two reasons: stringification of types not supported by default stringifier in assertion messages, and accuracy of floats in failure messages. The code of the stringifier is not referenced directly by any code of kata, so it can be removed and snippets will continue to compile (only messages will change at runtime). I expect the new framework to have some other way of solving the problem of presentation of data in texts (titles, messages, logs, whatever). One potential problem can be direct calls to I can try to set up GTest and Catch2 in my local VS and translate some kata and see how it goes. I do not know what kata can be especially tricky, except a couple of template metaprogramming ones ("factorial in compile time" etc), or macros, because they require the solution to be put in a header file - what might look awkward if
then I could take a look. To be honest I do not really see a good way to fit the C++ compilation model into the 3 snippets we have now. I think that repurposing preloaded will not prove to work well, and that ideal solution would be to introduce two more tabs (for //CW SOLUTION_H
... declaraitions, templates which are a part of solution
//CW SOLUTION_CPP
... definitions, private solution stuff
The markers and preprocessing could be potentially backed by the |
By updating the Kata we pursue the functionality indistinguishability? If so, I can't imagine particularly impossible one, but I can imagine the ones for which it would require time to make it proper. I personally think that it doesn't matter if we switch from the recent test framework to a newer one (despite the Authors/Translators who prefer to keep it as it is for some reasons). |
See https://gist.github.com/kazk/3732ef1b693a3c4483a0b8e75f0b524a for a list with a basic summary for each. There are some kata with only Kata with
Kata with
Kata with |
Yeah, that's what I expected. @ggorlen How is CCC C++ working for Qualified?
This won't happen. I can see Codewars eventually adding support for projects challenges (allows you to add files) like Qualified in the future.
Yeah, I guess we can support this for when the default doesn't work well. The runner can see if any markers are included and handle the submission differently.
Can you elaborate this directive? |
Looking briefly through the list, there is nothing in preloaded what couldnt be worked around:
As a bottom line, if there were no The interesting part which you did not show is solutions (and maybe solution setups) which contain Another idea: declare tasks which require users to provide solutions in a form of a template or a macro as unsupported. It would be a pity because it would prevent template metaprogramming tasks (or make them difficult to author), but most probably would also remove the necessity of having solution headers (if we verify, and agree, that re-declarations in tests work and are OK).
It's just a shot and it depends on what configuration of snippets will be finally used. Generally, the |
48 kata with |
Cool, I will try to do something useful with the lists over the weekend. |
I think it's only a problem if there are both headery and linkable entities? Otherwise it should be possible to |
IT might be just me, but something rubs me really bad when I see implementation files included as header files. Technically these are just files like every other so yeah, why not, but OTOH I am not sure I would call a setup which relies on including I will try to pick some kata from the lists and see if they can be set up in a way which would benefit from the EDIT: I took the kata Compile time #1 Factorial, which can be tricky in a new setup because its solution is a template. By applying Unnamed's suggestion I managed to run it locally after adding I will check if there are kata which mix linkable and non-linkable stuff in a solution, what would make this approach not valid for them. EDIT: I took a look at kata which mix linkable and non-linkable elements in a solution. There is a bunch of them, and they fail to run in their current form, but since the mixed stuff is in majority cases helper functions, they can be fixed and made compliant to the The only kata which seems to be impossible to fit into a setup without distinct snippets for |
@kazk I skimmed the thread but I'm not sure I'm totally ramped up and understand the issues at hand, so bear with me.
Do you mean "how does it work?" or "how is it working out for us?"--I assume the latter. I haven't had any blockers, just some fussiness figuring out name clashes between the solution and preloaded files, or something along those lines that I can't remember too well. I haven't worked on the C++ content in a good while. Let me know if there are any particular concerns and I'll see what I can offer. |
I created a prototype of a setup using a preprocessor: codewars/next-cpp#4 . Please note that it's by no means normative and I just hacked something to make it work in my local docker, and many things are most probably not suitable for a final CW setup. I will try to add more examples of snippets from migrating existing, potentially problematic kata, showcasing various approaches. |
Thanks Greg. Yeah, I mostly wanted to know if you saw any limitations or had any suggestions to how the classic code challenge works for C++. Thanks @hobovsky. I'll take a look. |
Use GCC. |
Possibly superseded by #307 |
Please complete the following information:
👍 reaction might help to get this request prioritized.
The text was updated successfully, but these errors were encountered: