Pages: 1
  Print  
Author Topic: Switch to C++11?  (Read 10544 times)
Offline (Unknown gender) TheExDeus
Posted on: October 26, 2014, 03:46:50 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
I am making some fixes here and there, and I'm an itching to use std::unordered_map among some other C11 stuff. Most of the stuff like std::unordered_map are in GCC since at least 4.5. Also, since we bundle MinGW on windows together with ENIGMA, we can actually control that the user has a new one. On Linux they usually already have a new one. The only downside as far as I know, is that we couldn't be able to support Visual Studio as easily (as MS adopts new standards as fast as stone statue chases birds). So should we enable -std=c++11? That could also bring other performance benefits down the road. The whole resource system could be written better in general.
Logged
Offline (Male) Josh @ Dreamland
Reply #1 Posted on: October 26, 2014, 07:19:11 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Go for it. I might want std::tie. And I'm curious if we'll get a performance hike for using unordered_map instead of map for instances and var.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Goombert
Reply #2 Posted on: October 26, 2014, 07:29:33 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
I am specifically looking to repackage the Portable ZIP with MinGW64, but it didn't go so well.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #3 Posted on: October 27, 2014, 06:27:53 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
64bit is another issue. But if everyone agrees, then I'll make the switch. There are a lot of fixes needed for that too (as some stuff changes in C+11, like math constants (M_PI) not being defined). I was mostly interested in hashing for caching right now. I needed a way to hash a state of a vertex attribute pointer, so I don't have to do 7 if checks per attribute, per draw call.
Logged
Offline (Unknown gender) sorlok_reaves
Reply #4 Posted on: October 27, 2014, 01:20:57 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
My opinion doesn't carry much weight on this, but I'm 100% agreed with switching to C++11.
Logged
Offline (Male) DaSpirit
Reply #5 Posted on: October 27, 2014, 02:47:52 pm

Member
Location: New York City
Joined: Mar 2013
Posts: 124

View Profile
What about C++14? :p

Anyway, I fully agree. What's the point of maintaining C++0x compatibility? I don't think there is any, or at least right now.
Logged
Offline (Unknown gender) sorlok_reaves
Reply #6 Posted on: October 27, 2014, 02:51:13 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
I think the idea is that C++11 support is solid at this point, while C++14 is still relatively untested. (So if someone can't compile ENIGMA, we now have to debug specific compiler versions, which can be annoying.)

But, then again, C++14 is only a minor addition on top of C++11. My intuition would be to ask "do you need or want anything from C++14? If not..."

Also, C++0x is, for all intents and purposes, C++11. I think the argument here is to switch from C++03, since C++0x/11 has lots of fun shiny things.
Logged
Offline (Unknown gender) TheExDeus
Reply #7 Posted on: October 28, 2014, 08:56:32 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
What's the point of maintaining C++0x compatibility?
We didn't even have that. We had classic C++03 which doesn't require any GCC flags.

Quote
My opinion doesn't carry much weight on this, but I'm 100% agreed with switching to C++11.
Everyone's opinion is important here. You do contribute to ENIGMA a lot, especially in parser and variable side of things, both of which can actually benefit from C++11. Like Josh said, all of the std::map stuff should just be changed to unordered_map when it makes sense. It's often a lot faster.

I just did the switch in my branch. I will do some linux tests and try to fix the GL3 debug mode on it. If I'm successful I will ask people to test it again. And then I can maybe finally merge it.
Logged
Offline (Male) Josh @ Dreamland
Reply #8 Posted on: December 07, 2014, 12:10:07 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
We're getting users with build errors because something isn't correctly configured to use ISO 11. On Windows, if I'm not mistaken. Is there an INI somewhere they can add --std=c++11 to?
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #9 Posted on: December 07, 2014, 04:13:50 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
I'm also on windows and don't experience any problems. There is no INI. We just need it in windows gcc.ey. There cxxflags: is set to -std=c++11 -I../Additional/i686-w64-mingw32/include . There was a makefile problem recently though, that caused many flags to be ignored. It was fixed here: https://github.com/enigma-dev/enigma-dev/commit/e05915f931cf69115738e1ae68f3eab47eeff8e8
Is there a specific error message?
Logged
Offline (Male) Josh @ Dreamland
Reply #10 Posted on: December 07, 2014, 05:12:32 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
After attempts to glean more information, I believe the best course of action is to wait for more problems or assume this is solved. Ignore me.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) sorlok_reaves
Reply #11 Posted on: December 07, 2014, 11:21:07 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
Maybe this is related to that "Makefile override" syntax bug I found recently? Although that's usually the opposite problem (ONLY the -std=c++11 flag is noticed).
Logged
Pages: 1
  Print