Re: Using C++11



On Mon, 29 Jun 2015 14:22:27 +0200
Murray Cumming <murrayc murrayc com> wrote:
(Sorry, I'm trying to keep this very simple.)

I don't know if Firefox depends on any other C++11 libraries so it
might not be the example I'm looking for.

Another for-instance question:
Ubuntu 15.04 (Vidid Vervet), which I'm running here, has g++ 4.9.2 and
its glibmm/gtkmm are built without --std=c++11. If SomeAppOrOther
depended on gtkmm as it is now, could its Ubuntu package be safely
built with or without --std=c++11?

SomeOtherApp (an appliction using gtkmm) _should_ be able to be safely
built with or without the -std=c++11 flag, if that application only uses
C++98/03 features  [1].  If SomeOtherApp uses C++11 features, then it
must be built with the -std=c++11 flag.  (For that matter it _should_ be
possible to compile gtkmm-3 with the -std=c++11 flag - set your
CXXFLAGS and give it a try.)

I say "should" because this assumes that the program, and the current
gtkmm headers, don't fall down some crack representing the minor changes
of existing features that occurred between C++03 and C++11, as
conveniently summarized in Appendix C2 of the C++11 standard.  For
example, "auto" has changed its meaning.  But this is very improbable
and easily fixed.  The C++11 standard was intended to be compatible
with existing code except in a few exceptional and unavoidable cases
which are rarely encountered in practice.

I have the feeling that you might have a slightly different question,
because the one referred to above doesn't seem relevant to the question
whether the next version of gtkmm should require C++11. If it does,
then user code would require to be compiled with the -std=c++11 flag,
as well as gtkmm itself.

Or were you asking what would happen if gtkmm-3 (a C++98/03 library)
were compiled with the -std=c++11 flag and a user program were not?  I
_think_ the user program would be OK but I would want to test it
first.  Even easier would be not to do it, or to ask on the g++ mailing
lists.

Chris

[1] But why would the author of SomeOtherApp compile it with
-std=c++11 if it were to be a C++98/03 only application?  One answer I
guess may be to make use of move semantics within the standard library,
for compilers which support it.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]