Here's a very helpful and informative blog post by Herb Sutter about some of the key new language features of C++11. I really recommend it to current CGT students, as there's a good chance it will start seeing adoption in the field in the next few years (i.e. by the time you graduate and get a job). If you know it in advance then I reckon you'll have better employability potential:
http://herbsutter.com/elements-of-modern-c-style/
In case you're wondering what parts of C++11 will be available in which compilers, Scott Meyers has a handy collection of references (see below). The link to Stephan T. Lavavej's summary of Visual Studio implementation will obviously be particularly relevant.
http://www.aristeia.com/C++11/C++11FeatureAvailability.htm
A quick note on the people I've mentioned above, in case you're not familiar with them: Sutter and Meyers are among the major C++ gurus, and are very influential in the language's evolution; Lavavej is a library developer for MS Visual C++.
Add a Comment
Comment by Christoffer Pettersson on November 1, 2011 at 16:36 Yea I've only tried winapi so far but I found it very messy. So was planning on looking into Boost or SDL. the thing with SDL though, is it used for anything other than games? If the principles of concurrent programming are common though like you said I could probably just pick one of them and then learn to use the other one as well.
Thanks :)
Comment by Kalakian on November 1, 2011 at 16:12
Comment by Peter Bloomfield on November 1, 2011 at 16:09 I'm afraid I'm not sure off-hand. I know Boost in general is highly regarded by many professionals, and parts of it are certainly used in several commercial products. I couldn't tell you how much the threading components are used in industry though.
The principles of concurrent programming are very common, so it's fairly straightforward to adapt to different libraries. If you want to learn about threading then I'd say Boost is a very good way to go, as it's cross-platform and open source.
Comment by Christoffer Pettersson on November 1, 2011 at 15:29
Comment by Kalakian on November 1, 2011 at 13:55
Comment by Peter Bloomfield on November 1, 2011 at 12:31 That's probably how it will be viewed by lots of programmers. :) It's supposed to improve readability and reduce typing errors though, e.g.:
auto iter = myMap.begin();
...is much simpler than:
std::map<int, std::string>::iterator iter = myMap.begin();
Comment by Kalakian on November 1, 2011 at 12:19
Comment by Peter Bloomfield on November 1, 2011 at 11:13 Yeah, I can imagine running into difficulties sometimes, particular when refactoring code. It would probably be quite easy to change the type accidentally, but then that's why explicit casts are often a good idea (even for up-casts).
You're right about auto not working for normal member variables, because any given class needs to have a fixed size determined by declaration alone. (Same goes for function parameters.) However, there are a couple of other ways auto can be used. One is for const static members of a class declaration, e.g.:
class SomeClass
{
const static auto MY_VALUE = 15;
};
The other use of auto is for trailing return types from functions. It's pretty obscure and I imagine it will almost never be needed by most programmers. Afaik, it exists so that some types of complex template functions can be resolved correctly by the compiler.
Comment by Kalakian on November 1, 2011 at 10:11 That's what I thought, so still have to be careful not to do something like:
auto myVar = new SomeClass();
Member variables can't use auto though, can they? I just had a brief read through the article, and it seemed that auto only works if you make an assignment during declaration, so auto is just for local variables then?
Comment by Peter Bloomfield on November 1, 2011 at 9:48 An auto variable is still statically typed, so polymorphism isn't affected at all. All that happens is that on initialisation of the variable the compiler effectively changes the "auto" declaration into the right-hand type (the one being assigned). You can re-assign the value of the auto variable during its lifetime, but it retains the same type. E.g.:
class BaseClass {...};
class SomeClass : public BaseClass {...};
class OtherClass {...};
auto myVar = new BaseClass(); // myVar has type: BaseClass*
myVar = new BaseClass(); // reassigning value of same type is OK
// Implicit up-cast is OK.
// Note that myVar is still type BaseClass*, so this is polymorphic:
myVar = new SomeClass(foo);
// Reassigning a totally different type is not OK:
myVar = new OtherClass(); // error!
Started by John Sutherland in News. Last reply by Daniel Livingstone May 11.
Started by Kalakian in Projects May 5.
Started by Peter Bloomfield in Portfolios & Employment. Last reply by Peter Bloomfield May 2.
Started by Daniel Livingstone in Portfolios & Employment Apr 25.
Started by Daniel Livingstone in Portfolios & Employment Apr 19.
76 members
55 members
52 members
50 members
48 members
43 members
41 members
32 members
30 members
29 members
© 2012 Created by John Sutherland.
Powered by
.
You need to be a member of WoSGamers to add comments!
Join WoSGamers