OSDev and C++0x
OSDev and C++0x
Hello everyone
With the release of Visual Studio 2010 and GCC 4.5 becoming closer and closer (the compiler releases that are supposed to take a major step towards C++0x), I was wondering what you think of this new "improvement" upon the C++ language. Do you think the newly added features will be useful in general (was something added that you kind of missed in C++?)? Do you see C++0x being used in kernels or operating systems (I'm referring to the ones being made here, of course). Why so?
Sorry for my barrage of questions, I'm just curious what your opinions are on C++0x. Myself, I'm kind of waiting until I can properly toy around with it. It seems to be promising but if it will really be that big of a deal, I don't know.
With the release of Visual Studio 2010 and GCC 4.5 becoming closer and closer (the compiler releases that are supposed to take a major step towards C++0x), I was wondering what you think of this new "improvement" upon the C++ language. Do you think the newly added features will be useful in general (was something added that you kind of missed in C++?)? Do you see C++0x being used in kernels or operating systems (I'm referring to the ones being made here, of course). Why so?
Sorry for my barrage of questions, I'm just curious what your opinions are on C++0x. Myself, I'm kind of waiting until I can properly toy around with it. It seems to be promising but if it will really be that big of a deal, I don't know.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: OSDev and C++0x
I'm mainly excited about lambdas. Whilst they could easily be abused, they are also a feature I've been missing for quite some time.
As for C++0x in a kernel? I'd say not until it's been tried and tested in applications, and even then I'd only use the features which do not require a C++0x runtime.
As for C++0x in a kernel? I'd say not until it's been tried and tested in applications, and even then I'd only use the features which do not require a C++0x runtime.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: OSDev and C++0x
auto! auto! auto!
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: OSDev and C++0x
Hi, and @OP: nice topic;
I'm with pcmattman, and I'd like to add that I also like the enhanced unicode string support idea.
--All the best
gravaera
I'm with pcmattman, and I'd like to add that I also like the enhanced unicode string support idea.
--All the best
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: OSDev and C++0x
I actually haven't had a look at the C++0x features yet. Since most of my work is maintenance coding, the vast majority of code I am handling (and will be for the forseeable future) isn't even up to par with C++ 98...
Every good solution is obvious once you've found it.
Re: OSDev and C++0x
Wikipedia has a pretty nice article on C++0x for those who don't know a lot about the features yet.
pcmattman wrote:I'm mainly excited about lambdas. Whilst they could easily be abused, they are also a feature I've been missing for quite some time.
Lambda expressions seem to be interesting to say the least. Seems like a good alternative for especially predicates which are a bit cumbersome to code if you have a lot of them.gravaera wrote:I'm with pcmattman, and I'd like to add that I also like the enhanced unicode string support idea.
Auto seems like a very useful construction, especially to replace constructions like this:Owen wrote:auto! auto! auto!
with this:Wikipedia wrote:for (vector<int>::const_iterator itr = myvec.begin(); itr != myvec.end(); ++itr)
I always found it kind of annoying to place the rather large type.Wikipedia wrote:for (auto itr = myvec.begin(); itr != myvec.end(); ++itr)
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Re: OSDev and C++0x
That's probably the one feature I feel most negatively about. It smells too much like VB's "variant", and IMHO goes against what C++ is all about. There's no simple way to find out what an "auto" variable can do...Owen wrote:auto! auto! auto!
Every good solution is obvious once you've found it.
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: OSDev and C++0x
And most certainly beats:Creature wrote:with this:Wikipedia wrote:for (vector<int>::const_iterator itr = myvec.begin(); itr != myvec.end(); ++itr)
I always found it kind of annoying to place the rather large type.Wikipedia wrote:for (auto itr = myvec.begin(); itr != myvec.end(); ++itr)
Code: Select all
for(std::vector<std::vector<int>::const_iterator>::const_iterator it = myvec.begin(); it != myvec.end(); it++)
My OS is Perception.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: OSDev and C++0x
But the auto thing can lead to some serious misuses that would be plain disatrous. Maybe they could insert some serious limitations on its use and where it can be placed. Otherwise I do see some potential for inexperienced coders to go do some murky things with it.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: OSDev and C++0x
Your typedef-fu is weak, old man.MessiahAndrw wrote:And most certainly beats:Creature wrote:with this:Wikipedia wrote:for (vector<int>::const_iterator itr = myvec.begin(); itr != myvec.end(); ++itr)
I always found it kind of annoying to place the rather large type.Wikipedia wrote:for (auto itr = myvec.begin(); itr != myvec.end(); ++itr)There have been circumstances where I've required that.Code: Select all
for(std::vector<std::vector<int>::const_iterator>::const_iterator it = myvec.begin(); it != myvec.end(); it++)
Re: OSDev and C++0x
Hi,
I can't wait for C++ 0x (or will it now end up being C++ 1x?), although I'm slightly disappointed that GC and Reflection don't feature (or have at least been postponed). Maybe I'm better off using D...
Cheers,
Adam
I see what you mean and there's no need to introduce things which lend themselves to too much to abuse, but IMO any language which allows pointer maths and casting of pointers is a bit of a potential minefield for inexperienced programmers anyway. I think that comes with the territory of using a language designed for systems programming.gravaera wrote:But the auto thing can lead to some serious misuses that would be plain disatrous. Maybe they could insert some serious limitations on its use and where it can be placed. Otherwise I do see some potential for inexperienced coders to go do some murky things with it.
I can't wait for C++ 0x (or will it now end up being C++ 1x?), although I'm slightly disappointed that GC and Reflection don't feature (or have at least been postponed). Maybe I'm better off using D...
Cheers,
Adam
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: OSDev and C++0x
Your saying this in a language which is descended from a language which "makes it easy to shoot yourself in the foot" and has been described as "making it easy to blow off your leg".gravaera wrote:But the auto thing can lead to some serious misuses that would be plain disatrous. Maybe they could insert some serious limitations on its use and where it can be placed. Otherwise I do see some potential for inexperienced coders to go do some murky things with it.
--
Actually, one other thing I like: std::vector<std::pair<int, int>> is now legal (Complaints that it messes up the lexer or parser are silly when you can generate me an error whining about it precisely anyway!).
And while I'll probably not be using concepts that much directly, when they get into the STL/Boost/OtherTemplateLibs, I will be so, so glad to see the end of 8 page template error messages!
(I think the running joke in the comitte has been, for a while now, that "the X is going to be in hexadecimal". I think they should go for "The x means it's in hexadecimal", and name it something like C++0xB:p)
Re: OSDev and C++0x
Hi ,
The auto keyword seems to be very similar to var keyword in C# ( 3.0 ) . Please note that introduction of the "var / auto " keyword does not make the language dynamically typed. I find it quite useful during prototyping (esp when iterating over a collection etc ) .
-- Thomas
The auto keyword seems to be very similar to var keyword in C# ( 3.0 ) . Please note that introduction of the "var / auto " keyword does not make the language dynamically typed. I find it quite useful during prototyping (esp when iterating over a collection etc ) .
-- Thomas
Re: OSDev and C++0x
I think auto can be acceptable when used with trivial for loops in place of ugly templates but should be avoided with everything else so it is easier to check what you can do with the object. But in this case I would still prefer typedefing.
Re: OSDev and C++0x
I agree that what the auto actually does can be dubious. It'll probably all work out fine for C++ STD library container types, like std::vector and such, but what will happen when we make custom classes and iterators (for our kernels, for example)? I smell hours of debugging coming up to find out the auto keyword was compiling fine but taking some unexpected type.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.