0

Does Arduino support C++ module import functionality i.e. what would it require to implement something like this in Arduino: import std;?

Juraj
18.3k4 gold badges31 silver badges49 bronze badges
asked Oct 7, 2024 at 8:10

1 Answer 1

2

Modules are a C++20 feature. The configuration files (platform.txt) of the cores provided by Arduino all ask the compiler to use one of the standards gnu++11, gnu++14 or gnu++17. These are C++11, C++14 and C++17 with some GNU extensions.

You will not be able to use C++ modules with standard Arduino cores. You will use the traditional header files instead. Optionally, you may build "Arduino libraries" by following the corresponding specification.

answered Oct 7, 2024 at 8:44
4
  • @Edgar Bonet Understood. Thank you for your comment. AOB: It appears someone gave my question a down vote. Could this have anything to do with my question itself or with the way it was framed? Feedback could help improve my future posts. Commented Oct 7, 2024 at 9:38
  • BTW, as per libraries, what's your thoughts on using third party vector container libraries? I saw one of such libraries which the author claimed could function like (but slightly different from) native std::vector<T> library. However, from your personal experience, could this pose potential drawbacks? Thank you in advance. Commented Oct 7, 2024 at 9:51
  • @beebee: I have no experience with those. I tend to use statically allocated plain C arrays, in order to avoid memory issues with dynamically-allocated memory. Commented Oct 7, 2024 at 9:59
  • Thank you so much. I appreciate your response Commented Oct 7, 2024 at 11:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.