Author Topic: c++11  (Read 9727 times)

Offline frithjofh

  • Regular
  • ***
  • Posts: 373
c++11
« on: October 11, 2013, 11:22:32 am »
hi everybody,

can the devs please tell if there are plans/considerations of adapting c::b to C++11, and if so when...

and, please, I don't post this to start a polemic. c::b is doing fine without C++11. i am just curious  :)

regards

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: c++11
« Reply #1 on: October 11, 2013, 11:27:36 am »
What exactly do you try to do ?
You can use c++11 for your projects already (if the compiler supports this, of course  ;) ).

Offline frithjofh

  • Regular
  • ***
  • Posts: 373
Re: c++11
« Reply #2 on: October 11, 2013, 11:30:23 am »
oh, sorry for not being clear on that...

I know that I can already use C++11 for my projects, I am actually doing so... ( I use the gcc 4.8 )

I wanted to know for c::b itself, its code, its plugins...
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12073
    • Travis build status
Re: c++11
« Reply #3 on: October 11, 2013, 11:35:12 am »
I wanted to know for c::b itself, its code, its plugins...
No, until all major long-term-support linux distros switch to GCC 4.7 at least.

Or to make it a bit more clear: When there is a RHEL/CentOS that uses GCC 4.7 as its native compiler and I've this distro installed on my work machine.
I've just switched to the latest CentOS and the compiler is GCC 4.4, so you're out of luck:)

Until then I'll revert all C++11 commits :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline frithjofh

  • Regular
  • ***
  • Posts: 373
Re: c++11
« Reply #4 on: October 11, 2013, 11:38:49 am »
makes sense I think ...
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline mistar

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: c++11
« Reply #5 on: October 14, 2013, 03:52:52 pm »
I wanted to know for c::b itself, its code, its plugins...
No, until all major long-term-support linux distros switch to GCC 4.7 at least.

Or to make it a bit more clear: When there is a RHEL/CentOS that uses GCC 4.7 as its native compiler and I've this distro installed on my work machine.
I've just switched to the latest CentOS and the compiler is GCC 4.4, so you're out of luck:)

Until then I'll revert all C++11 commits :)


It is possible to add C++11 code to C::B sources with
Code: [Select]
#if (__cplusplus >= 201103L)
// C++11 code goes here
#else
// old code here
#endif

and everybody would be happy...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12073
    • Travis build status
Re: c++11
« Reply #6 on: October 14, 2013, 04:24:00 pm »
and everybody would be happy...
And what is the benefit if we have to maintain both versions?
The idea of switching to C++11 is to make it easier to write and maintain C::B, so this will defeat the purpose of the switch.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5188
Re: c++11
« Reply #7 on: October 14, 2013, 06:20:45 pm »
there are ways to install more recent gcc on centos and family.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12073
    • Travis build status
Re: c++11
« Reply #8 on: October 14, 2013, 06:30:21 pm »
there are ways to install more recent gcc on centos and family.
This doesn't change anything, because they won't be the system compiler!
And would require hacking the LD_LIBRARY_PATH or using rpath for the libstdc++.so,
which will make using C::B on CentOS a nightmare and people won't do it.

Also it will be a nightmare to support on the various older Ubuntus...

p.s. from my tests GCC 4.6 is not a C++11 compiler one can depend on. GCC 4.7 is the first one.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ptDev

  • Almost regular
  • **
  • Posts: 222
Re: c++11
« Reply #9 on: October 14, 2013, 08:58:27 pm »
there are ways to install more recent gcc on centos and family.
This doesn't change anything, because they won't be the system compiler!
And would require hacking the LD_LIBRARY_PATH or using rpath for the libstdc++.so,
which will make using C::B on CentOS a nightmare and people won't do it.

Also it will be a nightmare to support on the various older Ubuntus...

p.s. from my tests GCC 4.6 is not a C++11 compiler one can depend on. GCC 4.7 is the first one.

I remember seeing a while back a program that was distributed as single packed archive that even contained its own version of libstdc++ and a number of system shared objects, so it is possible to provide a custom build that is not based on the system libraries, it will just prevent one from using debian packages or rpms, but it still is possible at the expense of a rather bloated binary distribution.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12073
    • Travis build status
Re: c++11
« Reply #10 on: October 14, 2013, 09:04:48 pm »
I remember seeing a while back a program that was distributed as single packed archive that even contained its own version of libstdc++ and a number of system shared objects, so it is possible to provide a custom build that is not based on the system libraries, it will just prevent one from using debian packages or rpms, but it still is possible at the expense of a rather bloated binary distribution.
Of course this is technically possible, all binary-only softwares do it.
But this is not the point of open source and we will loose all the benefits of distros.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline frithjofh

  • Regular
  • ***
  • Posts: 373
Re: c++11
« Reply #11 on: October 14, 2013, 09:13:45 pm »
I should not brought this up at all. but I think the devs are right from every practical standpoint...

just because I (or anyone else) like some features of C++11 is NOT enough.  ;)
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline mistar

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: c++11
« Reply #12 on: October 14, 2013, 10:06:25 pm »
I should not brought this up at all. but I think the devs are right from every practical standpoint...

just because I (or anyone else) like some features of C++11 is NOT enough.  ;)

Those features are designed to simplify code maintainance, memory management and many other things.
Of course, it would require wxWidgets to be written using smart pointers and RAII (and that would clean up their API, ownership management and so on, but it is out of scope here).
So, the important thing is that C++11 features are not just syntactic sugar to simplify writing code, but to simplify code design and those features would greatly help YOU, devs, to maintain C::B sources ;)

Offline frithjofh

  • Regular
  • ***
  • Posts: 373
Re: c++11
« Reply #13 on: October 15, 2013, 09:18:29 am »
hi,

so we found another point: the whole wxWidgets part of the game. What do the devs think about this, and the problem it presents for adapting c::b to c++11 ?

and as a note: I am certainly not a dev here :) just a guy who does programming in spare time. and I certainly don't mean to say that c++11 is syntactical sugar. nothing would be more wrong thinking. it takes out so much of the clumsiness of c++, and lets one focus more on what to express and achieve... my personal favorite are the lamdas and the move semantics...  ;D

regards
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline mistar

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: c++11
« Reply #14 on: October 15, 2013, 10:57:59 am »
hi,

so we found another point: the whole wxWidgets part of the game. What do the devs think about this, and the problem it presents for adapting c::b to c++11 ?

and as a note: I am certainly not a dev here :) just a guy who does programming in spare time. and I certainly don't mean to say that c++11 is syntactical sugar. nothing would be more wrong thinking. it takes out so much of the clumsiness of c++, and lets one focus more on what to express and achieve... my personal favorite are the lamdas and the move semantics...  ;D

regards

rvalue references are most important for an average programmer IHMO, they enable move semantics. Lambdas are just syntactic sugar (but of course very helpful) :)
Both wxWidgets and C::B would benefit much from using move semantics, mainly in passing wxStrings (for example long strings from text areas).
It is interesting that the following lines (in wxWidgets source) suffice to enable move semantics (as wxString uses std::string internally):
Code: [Select]
#if (__cplusplus >= 201103L)
  wxString(wxString &&) = default;
  wxString operator=(wxString &&) = default;
#endif

then pass a wxString by value whenever you modify it inside (a compiler decides whether to copy or move in this case) or by const ref for read-only.

Ok, a little bit offtopic, but I hope C::B will be going in right direction :)