modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
748 stars 132 forks source link

C++23 and C23 #968

Closed rleh closed 1 year ago

rleh commented 1 year ago

Do we plan to enable C++23 (and C23) for modm in the (near) future? This would give access to nice new lanuage and library features even already with GCC12.

salkinium commented 1 year ago

Sure, but C++23 is not final yet?

rleh commented 1 year ago

Yeah, but we use (only) GCC12 and it already implements a significant proportion of the standard.

chris-durand commented 1 year ago

C++23 is considered feature-complete and only small obscure details will change. I'd consider it safe to turn it on. While some bigger features are still missing in GCC 12 you'll still get a lot of nice things. Unless we want to maintain compatibility with GCC 10/11 for some reason but I don't think we have a strong motivation to do that.

salkinium commented 1 year ago

OK, then let's enable it after the 23q1 release, so that we/I can test GCC12 on C++20 and then GCC12 on C++23 separately.

salkinium commented 1 year ago

If you are motivated, I would also like to do some C++ upgrade work, ie. making everything constexpr (particularly constructors), spaceship operator (?), container iterators are deprecated, maybe more std functions/GCC builtins instead of inline asm, etc. Doesn't need to happen in this PR, but we'll probably get more mileage out of that than using the lastest C++ standard ;-)

rleh commented 1 year ago

OK, then let's enable it after the 23q1 release, so that we/I can test GCC12 on C++20 and then GCC12 on C++23 separately.

Good idea! The release is in 3 weeks already 😱

If you are motivated, I would also like to do some C++ upgrade work, [...]. Doesn't need to happen in this PR, but we'll probably get more mileage out of that than using the lastest C++ standard ;-)

Absolutely

salkinium commented 1 year ago

Reminder to self: Remove the GCC10 vs. GCC12 hacks in the build systems again.

salkinium commented 1 year ago

@rleh I'd be more happy to merge this PR though ;-P

salkinium commented 1 year ago

Let's do it, the new features are actually quite useful for embedded!

salkinium commented 1 year ago

Was there a reason you chose to remove 43b5f36 and 860bae2 from this PR? They're not critical, just useful.

rleh commented 1 year ago

Oups, that was unintentional. It probably happened during the rebase and I did not notice 😿