Towards improved C++ support for games, graphics, real-time, embedded systems [pdf]
open-std.org
open-std.org
Polymorphic allocators solve what's basically a non-problem for games (ABI boundary problems) while introducing huge other issues. Alignment is a PITA but not really a pressing IMO. The real issue is stuff like rebind and the requirements to call destructors (which destroys many practical implementations of pools and arenas, respectively). This probably falls under "STL puts an emphasis on correctness before practicality and performance".
...
Honestly (and I am aware this isn't a popular opinion, although it's much more popular inside the game industry than outside of it), IMO the STL-style of C++ programming is fairly wrong for games in general, largely because of memory usage concerns. This style of programming emphasizes worrying about lifetimes of objects by way of RAII, in order to allow a uniform way of treating all types of resources, both memory and otherwise.
This is convenient, but games need extremely tight control over non-memory resource management (need to reuse anything from the system, need to load lots of stuff in the background, etc). This means tying it to object and scope lifetime tends to be inflexible and cause future pain when you need to change the resource management scheme.
And for memory, games tend not to care a lot about cleaning up each objects memory individually, preferring to do it in bulk (e.g. resetting an arena or pool). This means that using RAII (or using something that uses RAII) for memory management tends to fit poorly for games.
So, IDK. I'm not holding my breath on the C++ standards committee making a decision that I care for, but it looks like they're making steps in the right direction nonetheless.
FWIW, I'm currently pinning my hopes on JAI, even though it's a long shot.
https://www.youtube.com/user/jblow888/playlists
See https://sites.google.com/site/jailanguageprimer/ for some fan-made notes from the videos
I asked about it and the response I got was basically "It's RIAA, that's how you do C++". The worst part is they have a caching system underneath that tracks OGL handles across different objects, and it's even safe for access by threads.
But whoever designed their texture class chose not to use it.
So when I read your description I understand where you're coming from a bit. I'm not sure I understand why you couldn't just avoid using destructors, but I've honestly never tried to use a C++ allocator for anything as I've never needed control quite that tight for anything I do.
That's exactly the issue SFML had. This idea that RAII implies tying resources directly to an objects lifetime. It doesn't.
If I have to build one more system that requires either a custom parser or repeating the names of all members, I think I will cry. The compiler ALREADY KNOWS!
Some light reading
[1] (static if) http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3613.pdf
[2] (call for compile-time reflection) http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3814.html
[3] (enum properties queries) http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3815.html
[4] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3996.pdfI give you the C++ standardization committee. Someone submits a paper to them with their issues and, moreover with solutions fully implemented in a library and also details the whys and wherefores. I have nothing to say whether this was good, bad or middling work just that the C++ standardization committee "has no record" of actually having read and considered it 8 years later and the chairs don't recall doing so. But I'm sure they all ran around as "anointed smart people" claiming all the others on the committee are anointed smart people instead. Sorry if I'm sounding a bit bitter but they really need to be called out, this is really gross. It's contemptuous of people making the effort to make the language better is the best you can say of it. Arrogant, stupid, unkind, vicious and bitter might describe me and I am sorry for it if you feel that way (please note it and I will try to do better), but I think it's also a fair description of this act by the committee.
Also on the front page today was Bruce Eckel's "thoughts on scala" which were utterly ridiculous for the first 10 minutes I watched. -He's a C++ stanardization committee alumni.
"We feel that a holistic "here's a new STL and our problems" approach to any change seems a bit doomed. "
WTF? You can't learn anything about what changes are desirable in the language from the implementation of how they solved their problems and assess whether they are more generally applicable? Pieces of them aren't worth assessing to be just adopted (or rejected)? You can't criticise what they tried and note the implementation and why the STL can do better?
Seriously if you can't learn anything from this on the committee what the hell are you doing? Well NOW they are looking at it, hurrah! While justifying why it wasn't done before, boo!
Mea culpa and a rocket up the committee members of the time seems vastly more appropriate if you actually care about this language. (Obviously if you don't, resign from the committee, immediately, anything else is immoral) If the members didn't care then, highlight the fact and state it is unacceptable going forward.
If it's common or garden (hopefully isolated) incompetence like all of us display at times. "We're very sorry this happened." Would seem to be about the minimum standard here. It's the arrogance that goes along with the committee when they act like this that really gets me.
www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1850.pdf
"Using an existing implementation of the C++ standard library as a base, we made backward-compatible modifications to enable such per-instance allocators."
I still don't know how I'd achieve per-instance allocator in modern "part-of-standard C++ STL." Is it possible? If yes, how? Does anybody know?
Well, there are two things you can do.
1. (Accepted in C++11) Allow stateful allocators. This is especially useful for things like pool allocators. Your container would keep a pointer to its allocator and perform allocator operations through it.
2. (Proposed but not accepted yet) Allow polymorphic allocators. This would allow different data structures to use different allocators but still have the same type. Basically it would look like 1 above, but instead of keeping an allocator pointer, you would keep a pointer to an allocator interface and perform allocator operations through virtual method calls.
Seems like every project has its own take on array classes and their ownership semantics. Std::vector appears to be largely useless (or at least it's not used anywhere in practice, so the effect is the same). Boost is just scary. Qt is almost like a different language by now.
I wish the C++ standard had something like Cocoa's NSArray/CFArrayRef -- a general-purpose ordered container that is consistently used everywhere in APIs and does the job everywhere, even though it may not be quite the optimal data structure. But I guess it's 15 years too late for that.
I think the proposed array_view is a much better choice in C++ land. The actual storage format of data (the data structure) should be an implementation detail, but there should be standard ways to share that data across various unrelated pieces of code.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n417...
The actual title: "Towards improved support for games, graphics, real-time, low latency, embedded systems."
These little pieces of censorship—that's not a sign that for some reason, we really don't like to talk about games. There's no pervasive second-class-citizenry attitude towards gaming. I don't really know how to interpret the omission, other than it's a little piece of little consequence.
Gaming keeps surfacing in places big and small as a motivation behind some technical or business innovation. Here we get very real improvements to the STL. This certainly matters: we celebrate Quake's square-root estimation trick as a cultural artifact, evidence of the beauty of programming. Elsewhere, in recent news, we hear Stewart Butterfield's narrative, which was as much about Flickr and Slack as it is about his twice-failed game concept. Lots of ideas and characters in the tech world have touched gaming in one way or another.
In my personal background at my startup, I keep running into folks pushed out of gaming. They start making "apps." Surrounded by app people, I might miss that a third of all new apps in the App Store are actually games[0]. Even then, games are disproportionately represented in Apple Design Awards. It's tough to get an accurate figure we'd all agree on, but I believe games are nonetheless also overrepresented in revenue (definitely from the looks of top grossing, if we're strictly speaking about mobile software).
If we really want to talk about software, I'd expect 1/3 to 1/2 of the content on the front page to actually be about games. It's certainly what most software people are working on, and it is probably where the plurality of the money is made. I'm not going to speculate as to why (I'd leave that for certain ex-Google developers, who possibly wanted to make a card game all his life). Here, we're actually seeing gaming omitted from the title, as though it's verboten.
While gaming does drive innovation and it's a very interesting field, I doubt that's what most software people are working on and surely it's not the biggest sector of software industry in general, it's actually quite small in comparison with many others. That's not to undermine its value, just pointing out the broader perspective.
Not sure where you got those ideas, but they're not even remotely true. Enterprise, while boring as all hell, is _huge_. The largest software vendors are (consistently) Microsoft, Oracle, IBM, and SAP[1]. According to Gartner, software was a $407.3B industry in 2013, and enterprise driven companies accounted for nearly half[2]. The video game industry pulled in $887M in 2014[3]. Not even close at .21%.
[1]: http://en.wikipedia.org/wiki/Software_industry#Size_of_the_i...
[2]: http://www.gartner.com/newsroom/id/2696317
[3]: http://www.statista.com/statistics/201093/revenue-of-the-us-...
And that's not counting embedded software, which is often sold as part of a hardware package.
If we go by Gartner[1], the games industry was predicted at $93billion in 2013. That's over 21%, so a couple of orders of magnitude more than 0.21%.
It is censorship in the sense that the original authors' intention is modified to exclude the 'game' factor, but then .. why is this happening in the first place? Why do you think the editing-OP decided to omit this aspect?
> "pushed out of gaming"
There are a couple of schools of thought about 'games programmers' and 'game systems' which can be plotted with wide variance, yet have some interesting points of intersection. For example, the 'factoid' that games developers have a high turn-over/rockstar-phase/kidzone aspect, unless your game is making millions, in which case its serious business and only big boys need apply. So 'game ideology' as an industrious, conscious body of knowledge, has the punk-rock factor, wearing a 2000 dollar suit.
>> we really don't like to talk about games.
Game development as a software ethos, either from consumer or developer side in my opinion, is an interesting quandry.
Many times the notion that you are not making a game if you're making, instead, a business app, or a web scraper, or an OS kernel, and so on .. But actually the notion of game is key to all computing. From a technological perspective, we're all just playing games. Even Oracle has its event and frame "inner loop".
So I think there's an ugly truth about why we "don't like o talk about games", and it is that there is a zen to the subject. The zen is profitable, and it is also deadly.
Keep playing games - no matter where you go and what you do there. Keep making games, too.
I didn't.
The other side of it, that a lot of games are made, is mostly reflective of the wishful thinking everyone has about games as a business. There are far more modified WordPress blogs out there than games, and they're probably more successful from a value standpoint.
Still, we discuss games often enough because they have that tendency to keep floating into the consumer space of tech.