Page 1 of 2

C++11

Posted: Thu Apr 04, 2013 17:35
by hdastwb
It's been out for a couple of years now and has fairly decent support in newer compilers; I think we should be able to use it in Minetest, thus I've submitted a pull request:
https://github.com/minetest/minetest/pull/596

Posted: Thu Apr 04, 2013 20:26
by PilzAdam
hdastwb wrote:fairly decent support in newer compilers;
What about the other compilers?

Posted: Thu Apr 04, 2013 20:34
by prestidigitator
Decent support in newer compilers? Like what? It's still experimental in g++, so good luck finding one that fully supports the standard. Maybe in another 10 years. :-/

Posted: Thu Apr 04, 2013 20:39
by kaeza
We should also port Minetest to JavaScript.
</troll>

Posted: Thu Apr 04, 2013 20:49
by hdastwb
I have been using ranged-for, auto, and lambdas in my code for the last year or so; many of the most prominent features are already implemented in VC++11, GCC 4.6, and newer clangs.

There should be absolutely no issue with using these features in any Linux distro that comes along with a working package manager; if you guys still do the Windows builds in VC++06 or something, then there might be cause to wait on upgrading.

Posted: Thu Apr 04, 2013 20:58
by PilzAdam
hdastwb wrote:I have been using ranged-for, auto, and lambdas in my code for the last year or so; many of the most prominent features are already implemented in VC++11, GCC 4.6, and newer clangs.

There should be absolutely no issue with using these features in any Linux distro that comes along with a working package manager; if you guys still do the Windows builds in VC++06 or something, then there might be cause to wait on upgrading.
Also MinGW should be supported.
And the packages for the compiler should be in Debian stable.

Posted: Thu Apr 04, 2013 21:42
by hdastwb
PilzAdam wrote:
hdastwb wrote:I have been using ranged-for, auto, and lambdas in my code for the last year or so; many of the most prominent features are already implemented in VC++11, GCC 4.6, and newer clangs.

There should be absolutely no issue with using these features in any Linux distro that comes along with a working package manager; if you guys still do the Windows builds in VC++06 or something, then there might be cause to wait on upgrading.
Also MinGW should be supported.
And the packages for the compiler should be in Debian stable.
MinGW's had a newer version than Ubuntu for a while now (they seem to have adopted 4.7 much earlier).

You have a point with Debian, though; it does appear that the squeeze g++ package is still 4.4.5 (though sid and wheezy are already at 4.7.2 like Ubuntu).

That said, one can always just write the cleaner code using the new features and use conditional compiling to swap it for the uglier, older code if needed; i.e.:

Code: Select all

#if __cplusplus > 199711L
    auto v = "C++11";
#else
    string v = "C++03";
#endif
    cout << v << endl;
Once the C++11 support is to everyone's satisfaction, it would be easy to go back through and get rid of all of the compatibility code.

Posted: Fri Apr 05, 2013 00:29
by hdastwb
Well, it's officially been killed; back to outdated C++…

Re: C++11

Posted: Wed Jan 28, 2015 13:04
by gregorycu
As time goes on, we should reflect where we are at with technologies. I think it's time to reassess where we are at with regards to C++11. I understand I am pulling up an old thread.

It has been 3 years since the standard was ratified, and while not many (any?) compilers boost full conformance, a lot of compilers have support for the most important features.

The new standard offers compelling features, and while it doesn't mean we can do anything new, it means we can code more easily. We get performance increases for free (due to moves), it is easier and faster to develop, we have a bigger library, and a benefit which is often overlooked: it is more fun!

While it seems stupid to list programming enjoyment as a benefit to using something, for an open source project, enjoying what you do is the best way to retain developers. Being able to be more expressive means more frequent, higher quality changes, with less chance of bugs (all else being equal).

I really cannot think of any legitimate reason NOT to use the new standard. While we may be decreasing the number of people who may be able to compile Minetest themselves, I don't think it's a percentage that is even worth worrying about. The new standards may be outside the understanding of some developers, but it should be a slow introduction with the most important features.

What do people think?

Re: C++11

Posted: Wed Jan 28, 2015 16:57
by hdastwb
You haven't found the github discussion on this yet, have you?
https://github.com/minetest/minetest/pu ... t-15932423

I really doubt they'll ever upgrade, since they seem to have some rather strong opinions on the subject. However, Freeminer has been using C++11 for a while now:
http://freeminer.org/

Re: C++11

Posted: Wed Jan 28, 2015 19:23
by jin_xi

Re: C++11

Posted: Wed Jan 28, 2015 20:07
by Krock
Thanks for pointing to this, even when I don't like C++11.
My OS supports C++11 only in a strange way, see this freeminer issue

Re: C++11

Posted: Thu Jan 29, 2015 16:28
by Zeno
gregorycu wrote:I really cannot think of any legitimate reason NOT to use the new standard. While we may be decreasing the number of people who may be able to compile Minetest themselves, I don't think it's a percentage that is even worth worrying about. The new standards may be outside the understanding of some developers, but it should be a slow introduction with the most important features.

What do people think?
I think it's wrong. 100% (or darn close to) of the people running servers compile minetest themselves.

If you think that 100% of the people running servers is not a percentage to worry about then that's a concern. Personally I'd rather worry about it.

The new features of C++11 are certainly not outside the understanding of any core developer.

The upgrade to C++11 should occur when all supported OSs and compilers support C++11. This is not the case at the moment. We should (and will?) support all LTS Linux versions.

This has nothing to do with the understanding of core developers (and, to be honest, your suggestion that core developers cannot understand the new standard is nothing short of offensive).

Those are the legititimate reasons. Trying to say "wahhh, nobody compiles minetest themselves" and "wahhhh, the developers cannot understand the changes to the standard" is complete and utter rubbish. These "reasons" you give for supporting c++11 are not legitimate reasons.

Re: C++11

Posted: Thu Jan 29, 2015 17:48
by celeron55
I have stated on IRC that we should start using the commonly supported parts of C++11 this year. Now I stated it here too.

Not doing so is unproductive. C++11 is a much more tolerable language than C++03.

I have been using the reasonable parts of C++11 for two years in other projects now, including one that compiles for Windows using MinGW and based on what I've seen, implementations are perfectly solid by now.

One of the most important blockers for the adoption of C++11 in Minetest was Debian stable's default compiler support. It's now there and is not a problem anymore. (Since the release of wheezy on January 10th, 2015 or something? Not sure, but it's there anyway.)

Long discussion today: http://irc.minetest.ru/minetest-dev/201 ... #i_4135238

End result: Probably at Debian 8 release. Windows will be a slight problem; prepare for that.

Re: C++11

Posted: Sat Jan 31, 2015 00:22
by Pitriss
Note: Debian squeeze LTS will have EOL at February 2016, so servers can still have this version. As I understood it, there will be no way how to compile MT server on it when it will contain any C++11 code.

Re: C++11

Posted: Sat Jan 31, 2015 14:56
by gregorycu
and, to be honest, your suggestion that core developers cannot understand the new standard is nothing short of offensive
Feel free to be offended, that is your right. It's a right you exercise freely and with reckless abandon, and I wouldn't want you to change.

I said that the new standards may be outside the understanding of some developers. What you decided to interpret it as that I said: "No core developer would be able to understand the new standard." I don't expect every core developer to be exposed to the new standard, I know many C++ developers who haven't even looked at it.

I'm getting rather sick and tired of your patronizing comments, implying I'm a baby (or at least I think that is what you're doing). I don't actually understand what value you think that this adds to the discussion, and it's a bit of a shame that a contributor thinks a constructive conversation should have this sort of material.

Re: C++11

Posted: Sat Jan 31, 2015 21:02
by Inocudom
hdastwb wrote:You haven't found the github discussion on this yet, have you?
https://github.com/minetest/minetest/pu ... t-15932423

I really doubt they'll ever upgrade, since they seem to have some rather strong opinions on the subject. However, Freeminer has been using C++11 for a while now:
http://freeminer.org/
You see? Freeminer is not a worthless piece of garbage; it too has real potential. Too bad nobody ever, ever plays on its servers though.

Re: C++11

Posted: Mon Feb 02, 2015 04:19
by HeroOfTheWinds
Not sure how much say I have in this, but here goes.

I personally agree with celeron55. It's been how long since C++ 11 was ratified, so why not take advantages of whatever benefits it can bring? No one is forced to use the new features it brings either. I use C++ 11 for all my coding, but I haven't looked at what changes it brings because I haven't had to use them yet. Only once have I worked with set templates, and that was just for a healthy dose of extra credit points in a college class. But in that one use, I saw many possible benefits, especially as I found the code slightly easier to understand in C++11 than in C++03. Wouldn't newer standards also mean newer security too?

@Inocudom: Yes, Freeminer has potential. But until it brings back mapgen Voxel Manip, not that interested.

Re: C++11

Posted: Mon Feb 02, 2015 16:31
by rubenwardy
Freeminer has potential because it uses C++11? What low standards.

I'm for it as long as less than 5 in 1000 users are lost through no compiler support.

Re: C++11

Posted: Wed Feb 04, 2015 03:15
by philipbenr
@Ruben:
Spoiler
No. That is functioning under the assumption that Ino has only stated that FM only has changed to C++11. There are many other changes, and he is trying to emphasize FM as much as possible. True, though. Those would be rather low standards, AND he should have said something else in that post to be clear.

But to be OT: I agree completely with the second part of you post. I'd hate to be one of those people. (Fortunately, I have to update my kernel and completely redo my nix-box, so I'd just include that anyway with the installation)

Re: C++11

Posted: Wed Feb 04, 2015 09:15
by Krock
rubenwardy wrote:Freeminer has potential because it uses C++11? What low standards.

I'm for it as long as less than 5 in 1000 users are lost through no compiler support.
I think that might take some years. C++03 has all features we needed in this game.
It's necessary to update when there's no other way but currently, I can't see any troubles.

Yes, I'm one of those 5 (or more) in 1000 and I would like to play Minetest as long as possible without getting a new OS.

Re: C++11

Posted: Thu Mar 05, 2015 22:15
by nrz
We must keep the compat with old compilers like Debian Squeeze, but if we need to do a break, maybe 0.5 or 0.6 can do this. 0.5 do the network rework, maybe we can think about C++11 ?

std::mutex, std::regex, that's two functions i need to use to replace our current working but obsolete implementation for mutexes. Having a portable representation for regex will be great too.

Re: C++11

Posted: Sat Mar 07, 2015 16:52
by philipbenr
I think not until 0.6 series. This give plenty of time to look for other solutions.

Re: C++11

Posted: Tue Mar 31, 2015 20:41
by hoodedice
I am not a developer, but I must highlight that 0AD, another open source game has switched to C++11

http://play0ad.com/new-release-0-a-d-al ... #more-3962

Re: C++11

Posted: Sun Apr 26, 2015 12:55
by jp
celeron55 wrote:End result: Probably at Debian 8 release.
Debian 8 released today (click). C++11 is it still in perspective ?