Live data from Hacker News

How to write good code with C++11

channel9.msdn.com

21–30 of 34 posts

Re: How to write good code with C++11

#21

Earlier quoted context omitted.

Erm, Microsoft are massive. They have lots of customers who have vastly differing needs which generally don't compete with each other. There are a LOT of Windows applications built on C++. Most games and most intensive applications are C++ based. Their corporate business customers generally use either C# or VB.Net with a large number still supporting legacy applications in Visual Basic. Their web customers naturally…

>Most games and most intensive applications are C++ based. That's what I'm trying to say. .NET is finally in the place where it's good enough for games (except AAA titles), unlike JVM it supports value types and has true generics that can generate proper collections for them (big deal for games where a lot of the data is in small tuples of floats) and lot's of "unsafe" stuff where you get direct memory access. Mono g…

If it's scientific/cluster computing/number crunching then - I'm speculating - but I doesn't sound like you want to be running Windows anyway and Microsoft doesn't ship their C++ tools for other platforms so that doesn't sound reasonable.

It is reasonable when you consider that Microsoft has been trying to break Windows into the HPC segment over the past two years or so. The perceived lack of a suitable toolchain and focus on the development of enterprise languages and technologies helped keep Microsoft out of that arena. This re-emphasis on C++ is a necessary, though not sufficient, step if they want to continue pushing for that market.

Re: How to write good code with C++11

#22
post #16

Earlier quoted context omitted.

Off topic - but I got to ask - what's up with Microsoft pushing C++ ? They were pushing .NET then all the sudden it's back to C++ .NET is for corporate stuff mostly. i.e in-company apps, corporate web apps and the like. They never touted .NET as a replacement for C++ for actual Windows apps and they never rewrote their apps (Office, etc) in .NET managed C#. In that area, .NET has been doing well. They don't propose p…

.NET is for corporate stuff mostly. i.e in-company apps, corporate web apps and the like. They never touted .NET as a replacement for C++ for actual Windows apps I don't agree with that. MFC was used for lots of corporate desktop applications and some if not most of those are being replaced by Windows Forms and WPF apps. Replacing C++ MFC apps with .NET is exactly what Microsoft told Windows developers to do in the p…

So what part you don't agree with? As I said, "They never touted .NET as a replacement for C++ for actual Windows apps" -- actual as in "not corporate".

So, we're in agreement here.

They did told them to replace old MFC with .NET, but only for corporate desktop applications, not actual shrink-wrapped desktop apps.

Re: How to write good code with C++11

#23
post #17

Earlier quoted context omitted.

>Most games and most intensive applications are C++ based. That's what I'm trying to say. .NET is finally in the place where it's good enough for games (except AAA titles), unlike JVM it supports value types and has true generics that can generate proper collections for them (big deal for games where a lot of the data is in small tuples of floats) and lot's of "unsafe" stuff where you get direct memory access. Mono g…

That's what I'm trying to say. .NET is finally in the place where it's good enough for games No, it's not. Only for higher level game logic. Even Word made with .NET would fill sluggish. Each layer of convenience has a penalty. It does gets better with Moore's law, but native also gets better along with it, so the gap remains. Plus, we always do more stuff with our software, so CPU demands are getting higher too. It'…

>Each layer of convenience has a penalty.

That's only true if you can beat the layer implementation, and frankly I don't know any programmers (including myself) that would beat a optimizing compiler in code generation.

>It's not like software (especially games) is static, so that the managed/native gap will get insignificantly imperceptible at some point.

Here you go : http://deltaengine.net/ - used in this game : http://soulcraftgame.com/ a pure managed game engine, cross platform (works on iOS, Android, WP, Windows - XBox/Linux/OSX planned next, possibly ported to other consoles). Also look up indie game titles, XNA, Mono games, etc. It's not AAA stuff, but I never claimed otherwise. Simple tools are far more valuable than performance in many scenarios.

Re: How to write good code with C++11

#24
post #4

Earlier quoted context omitted.

Me not really - Linus' critique of C++ had few points that could be rationally debated. A much better researched critique of C++ by Yossi Kreinin is here: http://yosefk.com/c++fqa/ And yeah, I'd much better like to see Kreinin than Linus in a C++ debate.

I personally enjoyed reading the FQA, and even learned about some C++ "subtleties" in the process. I note however that the FQA itself has its share of criticism. http://stackoverflow.com/questions/3171647/errors-in-c-fqa

When reading this rebuttal, keep in mind that it was written in 2010 while the FQA was written starting in 2007, and apparently based on the author's experiences with much older tools. All other things aside, if your compiler frequently miscompiles templates, using them is probably not a good idea.

Re: How to write good code with C++11

#25
post #16

Off topic - but I got to ask - what's up with Microsoft pushing C++ ? They were pushing .NET then all the sudden it's back to C++ (and JavaScript ?). Check out http://channel9.msdn.com/ , 5 out of ~9 videos about C++ on the front page. Meanwhile .NET projects like RX seem to be loosing steam, Silverlight is officially dead. I switched to JVM/Clojure so I haven't been following .NET/MS developments for the last year i…

Off topic - but I got to ask - what's up with Microsoft pushing C++ ? They were pushing .NET then all the sudden it's back to C++ .NET is for corporate stuff mostly. i.e in-company apps, corporate web apps and the like. They never touted .NET as a replacement for C++ for actual Windows apps and they never rewrote their apps (Office, etc) in .NET managed C#. In that area, .NET has been doing well. They don't propose p…

>So they give their customers a free and open source way to move away from Windows and run their .NET stuff in a Unix stack?

This is 2012, you don't win by trying to lock in your customers - because people have been burned more than a few times by that business model and there are plenty of alternatives (eg. Java, now with JavaFX 2/3 might make a decent push on the client side, especially if they implement it for iOS/Android).

Re: How to write good code with C++11

#26
post #22

Earlier quoted context omitted.

.NET is for corporate stuff mostly. i.e in-company apps, corporate web apps and the like. They never touted .NET as a replacement for C++ for actual Windows apps I don't agree with that. MFC was used for lots of corporate desktop applications and some if not most of those are being replaced by Windows Forms and WPF apps. Replacing C++ MFC apps with .NET is exactly what Microsoft told Windows developers to do in the p…

So what part you don't agree with? As I said, "They never touted .NET as a replacement for C++ for actual Windows apps" -- actual as in "not corporate". So, we're in agreement here. They did told them to replace old MFC with .NET, but only for corporate desktop applications, not actual shrink-wrapped desktop apps.

You said "So, .NET/C++: orthogonal". I interpreted that as "there is little overlap" and that's what I disagree with. 98% of both in-house or shrink-wrapped desktop apps could easily be written in C#/.NET. Those MFC apps are not just corporate. There's a large number of shrink wrapped desktop apps for all kinds of industries.

We are in total agreement that Microsoft never pushed Adobe to rewrite Photoshop in C#, but Photoshop and MS Office are a tiny, tiny niche as a share of all Windows desktop apps. So when MSDN suddenly starts promoting C++ for Windows desktop apps, I don't believe for a second that their target audience is a handful of Adobe devs.

C++ and .NET are not "orthogonal" at all on the Windows desktop.

You could make a point that their push is entirely about games and graphics/video processing. It didn't sound like that to me though.

Re: How to write good code with C++11

#27

Off topic - but I got to ask - what's up with Microsoft pushing C++ ? They were pushing .NET then all the sudden it's back to C++ (and JavaScript ?). Check out http://channel9.msdn.com/ , 5 out of ~9 videos about C++ on the front page. Meanwhile .NET projects like RX seem to be loosing steam, Silverlight is officially dead. I switched to JVM/Clojure so I haven't been following .NET/MS developments for the last year i…

Conspiracy theorists blame internal politics causing technology decisions to be made based on how it impacts the careers of those in charge.

http://stackoverflow.com/a/7524710

Re: How to write good code with C++11

#28
post #17

Earlier quoted context omitted.

That's what I'm trying to say. .NET is finally in the place where it's good enough for games No, it's not. Only for higher level game logic. Even Word made with .NET would fill sluggish. Each layer of convenience has a penalty. It does gets better with Moore's law, but native also gets better along with it, so the gap remains. Plus, we always do more stuff with our software, so CPU demands are getting higher too. It'…

>Each layer of convenience has a penalty. That's only true if you can beat the layer implementation, and frankly I don't know any programmers (including myself) that would beat a optimizing compiler in code generation. >It's not like software (especially games) is static, so that the managed/native gap will get insignificantly imperceptible at some point. Here you go : http://deltaengine.net/ - used in this game : ht…

That's only true if you can beat the layer, and frankly I don't know any programmers (including myself) that would beat a optimizing compiler in code generation.

We're not talking writing assembly vs having the compiler do it, here. We're talking using a high level language with features such as garbage collection, bounds checking etc, versus not.

Those kinds of layers are both expensive AND beatable, regardless of the "optimizing compiler".

For an extreme example, a C++ program can easily beat a JRuby program -- despite the JRuby program being run on an optimizing JIT compiler.

The only cost is more programmer work, but not in the scale of difficulty of writing assembly versus C++. And in fields such as Games and Multimedia, you don't sacrifice performance for programmer convenience.

Re: How to write good code with C++11

#29
There are so many uninformed comments here about .NET, WPF, and C++ that I don’t know to which to respond. So let me just leave this here:

1. .NET Framework and Managed C# is the highest programming abstraction level in Windows, and is the way most Windows Apps are now written.

2. The underlining system of .NET is written in C++ and C. And hence is why Microsoft is supporting unmanaged C++. Because it's part of everything.

3. WPF/xaml hasn't died. It has replaced WinForms. And is #1 way UIs are now written.

*This will all be complemented with the new Metro interface where JS/HTML5 are now also part of the top level.

Re: How to write good code with C++11

#30
post #22

Earlier quoted context omitted.

So what part you don't agree with? As I said, "They never touted .NET as a replacement for C++ for actual Windows apps" -- actual as in "not corporate". So, we're in agreement here. They did told them to replace old MFC with .NET, but only for corporate desktop applications, not actual shrink-wrapped desktop apps.

You said "So, .NET/C++: orthogonal". I interpreted that as "there is little overlap" and that's what I disagree with. 98% of both in-house or shrink-wrapped desktop apps could easily be written in C#/.NET. Those MFC apps are not just corporate. There's a large number of shrink wrapped desktop apps for all kinds of industries. We are in total agreement that Microsoft never pushed Adobe to rewrite Photoshop in C#, but…

C++ and .NET are not "orthogonal" at all on the Windows desktop.

Well, I believe they are, except if by Desktop you mean "corporate desktop".

But I mean all the hundreds of millions user desktops, which I don't consider a "tiny niche".

Post reply on HN