Page 2 of 4
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 7:29 am
by Solar
Exactly...
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 8:00 am
by JamesM
We should get some Haskell-fanboy in here to preach about the benefits of wide-ranging type inference. Combuster - care to weigh in?
Type inference is a beautiful beast, allowing strongly and statically typed programs while removing a lot of the verbosity. It is especially nice for implementing polymorphic types...
... oh look, that's what we're implementing in our current project! How coincidental!
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 10:19 am
by Combuster
JamesM wrote:We should get some Haskell-fanboy in here to preach about the benefits of wide-ranging type inference. Combuster - care to weigh in?
Eheheh, tempting
No, Haskell folks who don't define types for their functions are IMO just as bad for maintainability as the ones who think they can get away with goto...
Now when I'm posting anyway, C++0x doesn't solve the current problems with c++, very annoying for beginners, hard to debug error messages, no context-free grammar, and no widely available compiler that is fully compliant.
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 10:25 am
by Owen
Goto is still the best way to handle errors when RAII isn't available, though. Sure, there are other methods; but they're clunky, and involve bludgeoning control structures to do things they're not supposed to.
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 12:16 pm
by Thomas
Hi ,
goto is not completely bad . If you disagree , you disagree with Donald E Knuth as well
. Please take a look at this paper :
http://portal.acm.org/citation.cfm?id=1241535 .
-- Thomas
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 1:08 pm
by Owen
Combuster wrote:hard to debug error messages
Wha? Concepts have solved those!
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 6:23 pm
by JamesM
Donald Knuth, while a legend, has never been a paragon of good software engineering practice. By the same token, if you hold your opinion, you also disagree with
Edsger Dijkstra.
Re: OSDev and C++0x
Posted: Thu Dec 10, 2009 11:05 pm
by Love4Boobies
JamesM wrote:
Donald Knuth, while a legend, has never been a paragon of good software engineering practice. By the same token, if you hold your opinion, you also disagree with
Edsger Dijkstra.
Literate programming is considered a good practice. Anyway, I don't really care much about either what Knuth or Dijkstra think but I see
goto of being useful in any of the two following situations:
- Jumping out of a nested loop (since break only takes you out of the current one)
- When produced by parser generators or other types of compilers
Re: OSDev and C++0x
Posted: Fri Dec 11, 2009 2:39 am
by Solar
Love4Boobies wrote:...I see
goto of being useful in any of the two following situations:
- Jumping out of a nested loop (since break only takes you out of the current one)
Isolate the loops in a function and use
return instead of
goto.
Re: OSDev and C++0x
Posted: Fri Dec 11, 2009 2:43 am
by Love4Boobies
Why? Just to avoid writing "goto"? I think that practice is much worse and decreases readability (not to mention performance).
Re: OSDev and C++0x
Posted: Fri Dec 11, 2009 3:38 am
by Solar
I think it very much improves readability
because it gets rid of the goto. A return, even a break, is very well-defined in where it returns / breaks to. A goto doesn't carry that kind of information, you have to search for the target label.
As for performance, a) inline functions aren't that hard to do and b) I'd worry about the nested loop's contents more than about the one additional function call.
Oh, and c) I worked years in an environment where code containing "goto" statements would get rejected by the pre-commit hooks of the version control system, so...
Re: OSDev and C++0x
Posted: Sat Dec 12, 2009 7:36 pm
by Owen
Owen wrote:Combuster wrote:hard to debug error messages
Wha? Concepts have solved those!
An addendum: I was just reading up on C++0x and discovered Concepts have been cut. Aww
Re: OSDev and C++0x
Posted: Mon Dec 14, 2009 5:07 pm
by thre3dee
The thing with auto in C++0x's case is that the type is still uniquely defined by the r-value. Whatever expression is returning an r-value, the type must always be a certain type since the r-value itself can never be a "dynamic" type because of C++'s inherent statically typed nature which is why I'm very much looking forward to it.
The other thing is that IDEs will easily know what type the variable is given that they will know what the r-value's type is so as long as you are using a capable IDE, you won't need to go back to the variable definition to see what type is being assigned.
I don't really care for GC and managed-ness in C++0x as I would rather it retain the speediness of native unmanaged code. The other thing is that C++ is ubiquitous with being manually memory managed and I'm sure most of us still like the fact that we have control over this.
Re: OSDev and C++0x
Posted: Mon Dec 14, 2009 10:44 pm
by Love4Boobies
I most certainly do. If C++ had managed code and GC and I needed those features I wouldn't use C++ anyway, I'd use C# instead which is better for this type of high-level programming for many reasons.
Re: OSDev and C++0x
Posted: Wed Dec 30, 2009 1:13 pm
by -m32
One thing I think is just frigging stupid:
WTF? Every other language uses NULL or null. Are they just trying to defy convention? No sh|t null is used in the context of pointers.