Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Miguel Gimenez on September 10, 2026, 02:04:03 pm

Title: Change to C++17?
Post by: Miguel Gimenez on September 10, 2026, 02:04:03 pm
There is an updated version of astyle library (3.6.18) that fixes some issues (see ticket 1643 (https://sourceforge.net/p/codeblocks/tickets/1643/), but it uses the stupid C++17-only std::string_view and we currently are using C++11.

There is also some C++17-only code, like [fallthrough] in clangd_client, generating warnings.

Should we change to C++17?
Title: Re: Change to C++17?
Post by: LETARTARE on September 10, 2026, 03:03:09 pm
Have you tried to compile the full version with C++17 (Win-xx, Linux-xx) ?
If so, what warnings have you obtained ?
Title: Re: Change to C++17?
Post by: LETARTARE on September 10, 2026, 03:18:30 pm
Leap-15.6-64bits, wx-3.2.8;gtk3-u, gc-15.2
'r14003.cbp' ( no 'contrib' )
Here is the compilation log with 'C++17' :
Title: Re: Change to C++17?
Post by: Miguel Gimenez on September 10, 2026, 04:38:02 pm
Quote
Have you tried to compile the full version with C++17

I have not tried, developers must agree on the change beforehand. Changing the CBP is easy, the problem may come later from autotools.

Errors in Squirrel can be fixed, but it uses tricky memory accesses that may be a headache.
Title: Re: Change to C++17?
Post by: gd_on on September 10, 2026, 05:49:27 pm
Just to inform you that with my CodeBlocks_Windows.workspace, and setting my global variable cb_build.cpp_std to gnu++20, codeblocks compiles correctly as far as I have tested. Of course, this does not cover all build methods.
Title: Re: Change to C++17?
Post by: christo on September 10, 2026, 06:50:06 pm
Hi Miguel,

I've been using c++20 for a long time without any issues in my custom branch's  autotools build on ubuntu. I think we can upgrade to c++20 directly.

For autotools, following change should be sufficient : https://github.com/josephch/codeblocks/commit/c56d5feaf0ce0c5d511263d1fba29e3713af68e2
Title: Re: Change to C++17?
Post by: Pecan on September 10, 2026, 06:51:50 pm
I use wx2.3.8 and wx3.3.3 for CodeBlocks (all compiled at c++20) every day.
Title: Re: Change to C++17?
Post by: Miguel Gimenez on September 10, 2026, 07:02:09 pm
Should we use gnu++20 or plain c++20?
Title: Re: Change to C++17?
Post by: christo on September 10, 2026, 07:17:29 pm
I think plain c++20 should be okay as we do not use any gnu specific extensions.

Regarding squirrel warnings, looks like it is fixed upstream by casting : https://github.com/albertodemichelis/squirrel/commit/6ad6f6427157757c4431907dde0a1e5712a5cf67
Title: Re: Change to C++17?
Post by: stahta01 on September 10, 2026, 07:50:38 pm
Remember to update the file from "https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html" in the "m4" folder.

The link above did not work searching found this link "https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_cxx_compile_stdcxx.m4"

Title: Re: Change to C++17?
Post by: killerbot on September 10, 2026, 08:07:09 pm
I am building the nightlies for a few weeks (?months) with -std=c++23.

I would suggest to step up to 23, and let's avoid extension, so I would suggest not to use 'gnu++xx'.

What do you think ?
Title: Re: Change to C++17?
Post by: LETARTARE on September 11, 2026, 12:23:50 am
@christo :Thanks
Errors in Squirrel are removed by the indicated correction. (r14011)
Title: Re: Change to C++17?
Post by: Miguel Gimenez on September 11, 2026, 09:13:56 am
Squirrel warning removed in r14013, thanks christo and LETARTARE.
Title: Re: Change to C++17?
Post by: Miguel Gimenez on September 16, 2026, 02:18:20 pm
My current development environment (MinGW8.1) only supports upto C++2a, I can change C::B to C++20 or C++23 but then I will be out of the game for a while...
Title: Re: Change to C++17?
Post by: christo on September 17, 2026, 06:10:53 am
My current development environment (MinGW8.1) only supports upto C++2a, I can change C::B to C++20 or C++23 but then I will be out of the game for a while...

I think c++17 should be fine for now
Title: Re: Change to C++17?
Post by: ollydbg on September 17, 2026, 02:34:38 pm
I'm OK with C++17.

BTW: about the code repo, can we switch to git?
Title: Re: Change to C++17?
Post by: Miguel Gimenez on September 17, 2026, 07:56:14 pm
Would tickets be moved also?
Title: Re: Change to C++17?
Post by: ollydbg on September 19, 2026, 03:57:25 am
Would tickets be moved also?

If the git means github, then I found that there are some project which can import sourceforge ticket to github, something like: Ajnasz/sf2gh: Move sourceforge tickets to github (https://github.com/Ajnasz/sf2gh) or cmungall/gosf2github: migrates tickets to GH from SF (https://github.com/cmungall/gosf2github).

I don't want to use SVN, because SVN can't let me create a serial of patches.  :(
Title: Re: Change to C++17?
Post by: LETARTARE on September 21, 2026, 10:03:05 am
I use 'https://codeberg.org/ (https://codeberg.org/)' which has a translation service : 'https://translate.codeberg.org/ (https://translate.codeberg.org/)'
Title: Re: Change to C++17?
Post by: killerbot on September 23, 2026, 07:09:18 pm
are there any objections to switch to c++20 or even c++23 ?

I think the winlibs gcc ports for windows also nicely support it, because I build CB (and wx) with it, and that goes fine.
Title: Re: Change to C++17?
Post by: gd_on on September 24, 2026, 09:23:51 am
I usually build CB with gnu++20 (even tests with gnu++26). No problems, except a few warnings concerning obsolete things which are not there with c++17. I have seen that the generated code is a little bit bigger.