ENIGMA Forums

Contributing to ENIGMA => Developing ENIGMA => Topic started by: TheExDeus on October 26, 2014, 03:46:50 pm

Title: Switch to C++11?
Post by: TheExDeus on October 26, 2014, 03:46:50 pm
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.
Title: Re: Switch to C++11?
Post by: Josh @ Dreamland on October 26, 2014, 07:19:11 pm
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.
Title: Re: Switch to C++11?
Post by: Goombert on October 26, 2014, 07:29:33 pm
I am specifically looking to repackage the Portable ZIP with MinGW64, but it didn't go so well.
Title: Re: Switch to C++11?
Post by: TheExDeus on October 27, 2014, 06:27:53 am
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.
Title: Re: Switch to C++11?
Post by: sorlok_reaves on October 27, 2014, 01:20:57 pm
My opinion doesn't carry much weight on this, but I'm 100% agreed with switching to C++11.
Title: Re: Switch to C++11?
Post by: DaSpirit on October 27, 2014, 02:47:52 pm
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.
Title: Re: Switch to C++11?
Post by: sorlok_reaves on October 27, 2014, 02:51:13 pm
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.
Title: Re: Switch to C++11?
Post by: TheExDeus on October 28, 2014, 08:56:32 am
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.
Title: Re: Switch to C++11?
Post by: Josh @ Dreamland on December 07, 2014, 12:10:07 pm
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?
Title: Re: Switch to C++11?
Post by: TheExDeus on December 07, 2014, 04:13:50 pm
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?
Title: Re: Switch to C++11?
Post by: Josh @ Dreamland on December 07, 2014, 05:12:32 pm
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.
Title: Re: Switch to C++11?
Post by: sorlok_reaves on December 07, 2014, 11:21:07 pm
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).