-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Please support C++17 by default #435
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
Comments
This comment has been minimized.
This comment has been minimized.
I guess because the avr-gcc 7.3.0 does not support C++17 to the full extent. But C++14 would make sense. Or Arduino.cc changes to avr-gcc 9.4.0 with C++17 per default. Even better would be avr-gcc 11.2.0, but then corrections would have to be made in even more places in the framework. Because much of the syntax was set to deprecated. By the way, you can also create a platform.local.txt. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sure everyone can do this, but it's not the same as having c++17 as a default for the core, as well as all the libraries. Of course it was just a question to know if there were plans to add it in the near future, I don't expect it. |
No one is going to rewrite all libraries. Who is going to do that? You are asking too much. You must look only once how old the usual libraries are. Nobody cares anymore as long as it works. But you can write and maintain your own libraries according to C++17 or even C++20. |
Why should one need to rewrite all libraries? I thought that the problem here was with
I think there was a misunderstanding. I'm just asking if there are plans to switch to c++17 by default. To be clear, are you speaking on behalf of arduino.cc? |
Is there a misunderstanding or do you have a misconception? If you don't want all libraries to be rewritten or you think they shouldn't be rewritten to language standard C++17, then why do you want default C++17? Just because the toolchain may compile with C++17 setting does not automatically make it C++17 code. The possibilities of a higher language standard must already use the programmer. I think you are imagining it wrong. And no I have nothing to do with Arduino.cc. I just use it very often. |
@grobx Unfortunately, according to @mikrocoder 's logic, there will hardly ever be any plan to switch, as long as modern PCs still support gcc-7.3.0. That is, only Windows, Linux or MacOS can force the author to upgrade gcc by deprecating its old versions, since no one is going to rewrite all libraries as long as they can still work.🙂 |
I was talking about me asking for any plan to go with c++17 by default and you continuing to reply on behalf of someone else that its not going to happen. Anyway, I think this discussion can't go any further, so I'll leave it to others. |
@grobx @Silver-Fang |
It feels like there might be some misunderstanding here, maybe I can help clarify. I cannot speak on behalf of Arduino, but I do have been involved with various of their development in the past. This repo contains the Arduino AVR core, which decides which compiler version is installed along with it and what options it is called with. Those options define the C++ version used for all C++ code. There is nothing a library or sketch (or even the user, apart from modifying the core) can do to change the options for the C++11 version. So this means if any code (i.e. your sketch) wants to use e.g. C++17 things, the core must enable C++17. Which is why different people in this issue have asked about this. In general, C++ versions are reasonably backward compatible (i.e. code written for C++11 is going to work with C++17), though I think there are some parts that do not work. This means that if the AVR core bumps the C++ version to C++17, most code will continue to work. Since maybe not everything would work, upgrading C++ version is something to be done with care (and testing).
I'm not sure I follow this. Arduino.cc developers are busy working on all kinds of things, but AFAICS there is just a lot of things on their list, so I expect this is a thing that they are just not getting around to this. Also, the IDE 2.0 still uses this core for AVR boards, so (except because time is limited), work on IDE 2.0 does not conflict with work on this core. However, as already mentioned, supporting C++17 might need a newer gcc version, which makes this a bit more complicated than just adding a compiler option (which makes it more likely to be postponed until later). |
Much too complicated. The only thing that happens with the new toolchain is that more warnings are displayed. You have to live with that or fix them. Only the warnings should help the programmer to write clean code. -Wno-volatile is a stopgap, otherwise you would have to rework the whole Arduino core. And adding a new toolchain is not complicated. If you don't compile it yourself you can use the one from Zak Kemple. https://blog.zakkemble.net/avr-gcc-builds/ Whether 32 bit or 64 bit is completely irrelevant. If in doubt, use 32 bit. create a local.platform.txt. There is already a platform.txt in the folder, we do not change it.
For all this to make sense, all compiler warnings etc. must be turned on in the IDE's preferences. Restart the IDE and off you go. But as I said. The toolchain with C++17 or even C++20 setting only provides you with the possibility to use the new language features. Old code remains old code. You can continue to use C++11. Then nothing changes. If you have added additional core packages to the IDE, you have to create the local.platform.txt in all package paths. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c++20移行にしたければ,以下が参考になる. arduino/ArduinoCore-avr#435 (comment)
c++20以降にしたいなら,以下が参考になる. arduino/ArduinoCore-avr#435 (comment)
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Although it is very interesting, I would appreciate it if we can keep this discussion tightly focused on the original subject matter. You are welcome to continue the other conversations on the Arduino Forum: |
My code contains variable templates that C++11 does not support. So each time I set up Arduino IDE for a new PC/user, I'll have to go to "%AppData%\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt" and set the "-std=gnu++17" compiler argument. Isn't C++17 fully compatible with C++11 code? Why is the old C++11 still the default?
Additional context
Additional requests
Related
The text was updated successfully, but these errors were encountered: