News for hackers. Stuff that matters.
Re:Counting Bugs in Windows Calculator by tonyedgecombe on Wednesday March 13, 2019 @04:03AM (#19376653)
It’s interesting that most of these would have been avoided by using a safer language than C++.
Re:Counting Bugs in Windows Calculator by renholder on Wednesday March 13, 2019 @05:19AM (#19377023)
Calculator has been around since ninteen-eighty-something-or-other[0] and this seems to be a revamp of the base code, with a XAML (read: WPF) wrapper[1].

Aside from the obvious answer of them using C++ based upon "using something you know and that works", why shouldn't they have used C++? (Genuinely wanting to know/understand.)

It would seem like a monolithic task to rearchitecture the entire app versus just dropping the code-behind into a new UI wrapper, yeah? I'm not excusing it, to be sure, just explaining the potential ROI perspective they might've had when they stuck with C++.

[0] - https://en.wikipedia.org/wiki/Windows_Calculator#History

[1] - https://en.wikipedia.org/wiki/Windows_Calculator#Windows_10

Re:Counting Bugs in Windows Calculator by ygra on Wednesday March 13, 2019 @05:27AM (#19377061)
The code base has changed quite a bit since 198x:

- https://blogs.msdn.microsoft.com/oldnewthing/20040525-00/?p=...

- https://blogs.msdn.microsoft.com/oldnewthing/20160628-00/?p=...

- https://blogs.msdn.microsoft.com/oldnewthing/20180704-00/?p=...

This might also explain the choice of C++. Rather than rewriting their calculation engine in another language (it works, so a rewrite is rarely a good idea), UWP (not WPF; XAML is merely an XML dialect for object graphs and works pretty much anywhere if you want it to) allows you to write the UI in C++ (C++/CX to be precise) as well, and the UI code is for the most part not that complicated that C++ is a major impediment. That, and of course, most developers for Windows applications at Microsoft are familiar and well-versed in C++. Rewriting it in JavaScript or C# may take longer.

Re:Counting Bugs in Windows Calculator by gardaani on Wednesday March 13, 2019 @08:02AM (#19377806)
It will be interesting to see how soon they will convert it to C++/WinRT because C++/CX will be retired at some point.

The first step toward full C++/WinRT support within Visual Studio and the eventual retirement of C++/CX happened today with the availability of build 17025 of the Windows SDK Insider Preview.

https://moderncpp.com/2017/11/01/cppwinrt-in-the-windows-sdk...

Re:Counting Bugs in Windows Calculator by renholder on Wednesday March 13, 2019 @05:41AM (#19377113)
>Rewriting it in JavaScript or C# may take longer.

This is very true. If we look at Exchange, as an example, most of it was ported to .NET between E12 (2007) and E14 (2010) but Information Store wasn't able to be fully ported to C# until E15 (2013)[0,1].

[0] - https://docs.microsoft.com/en-us/exchange/managed-store-exch...

[1] - https://en.wikipedia.org/wiki/History_of_Microsoft_Exchange_...

Re:Counting Bugs in Windows Calculator by tonyedgecombe on Wednesday March 13, 2019 @07:36AM (#19377692)
why shouldn't they have used C++

I didn't say they shouldn't, I just thought it was interesting to see.

Re:Counting Bugs in Windows Calculator by EpicBlackCrayon on Wednesday March 13, 2019 @07:21PM (#19384984)
Yeah, nobody is talking about this but I think you're right on the money.
Re:Counting Bugs in Windows Calculator by kriive on Wednesday March 13, 2019 @04:46AM (#19376862)
Rust Evangelism Strike Force
Re:Counting Bugs in Windows Calculator by EpicBlackCrayon on Wednesday March 13, 2019 @07:20PM (#19384977)
Not even Rust necessarily. I mean, this could have been avoided with any of the new age languages with a focus on safety.
Re:Counting Bugs in Windows Calculator by tonyedgecombe on Wednesday March 13, 2019 @07:39AM (#19377698)
Judging by the downvotes it's more like the C++ Evangelism Strike Force.
Re:Counting Bugs in Windows Calculator by matmg on Wednesday March 13, 2019 @06:28AM (#19377373)
Rust will always be niche. It won't win to C/C++. Sorry mate.
Re:Counting Bugs in Windows Calculator by tonyedgecombe on Wednesday March 13, 2019 @07:37AM (#19377695)
I didn't say anything about Rust, in fact I have never used it.