C++11

For people working on the C++ code.
hdastwb
Member
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb
Location: United States

C++11

by hdastwb » Post

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

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

hdastwb wrote:fairly decent support in newer compilers;
What about the other compilers?

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Post

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. :-/

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

We should also port Minetest to JavaScript.
</troll>
Last edited by kaeza on Thu Apr 04, 2013 20:39, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

hdastwb
Member
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb
Location: United States

by hdastwb » Post

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.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

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.

hdastwb
Member
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb
Location: United States

by hdastwb » Post

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.

hdastwb
Member
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb
Location: United States

by hdastwb » Post

Well, it's officially been killed; back to outdated C++…

gregorycu
New member
Posts: 3
Joined: Wed Jan 28, 2015 12:52
GitHub: gregorycu
IRC: gregorycu
In-game: gregorycu

Re: C++11

by gregorycu » Post

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?

hdastwb
Member
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb
Location: United States

Re: C++11

by hdastwb » Post

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/

jin_xi
Member
Posts: 165
Joined: Mon Jul 02, 2012 18:19

Re: C++11

by jin_xi » Post


User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: C++11

by Krock » Post

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
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Zeno
Member
Posts: 140
Joined: Sun Jun 29, 2014 03:36
GitHub: Zeno-
Location: Australia

Re: C++11

by Zeno » Post

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.

User avatar
celeron55
Administrator
Posts: 532
Joined: Tue Apr 19, 2011 10:10
GitHub: celeron55
IRC: celeron55

Re: C++11

by celeron55 » Post

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.

User avatar
Pitriss
Member
Posts: 254
Joined: Mon Aug 05, 2013 17:09
GitHub: Pitriss
IRC: pitriss
In-game: pitriss
Location: Czech republic, Bohumin

Re: C++11

by Pitriss » Post

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.
I reject your reality and substitute my own. (A. Savage, Mythbusters)
I'm not modding and/or playing minetest anymore. All my mods were released under WTFPL. You can fix/modify them yourself. Don't ask me for support. Thanks.

gregorycu
New member
Posts: 3
Joined: Wed Jan 28, 2015 12:52
GitHub: gregorycu
IRC: gregorycu
In-game: gregorycu

Re: C++11

by gregorycu » Post

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.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

Re: C++11

by Inocudom » Post

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.

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: C++11

by HeroOfTheWinds » Post

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.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: C++11

by rubenwardy » Post

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.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: C++11

by philipbenr » Post

@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)

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: C++11

by Krock » Post

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.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

nrz
Developer
Posts: 131
Joined: Sat Feb 07, 2015 17:16
GitHub: nerzhul
IRC: nrzkt
In-game: nrz
Location: France
Contact:

Re: C++11

by nrz » Post

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.

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: C++11

by philipbenr » Post

I think not until 0.6 series. This give plenty of time to look for other solutions.

User avatar
hoodedice
Member
Posts: 1374
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

Re: C++11

by hoodedice » Post

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
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
jp
Banned
Posts: 947
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: C++11

by jp » Post

celeron55 wrote:End result: Probably at Debian 8 release.
Debian 8 released today (click). C++11 is it still in perspective ?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests