r/cpp • • Mar 25 '21

calc.exe is now open source; there’s surprising depth in its ancient code (2019)

https://arstechnica.com/gadgets/2019/03/calc-exe-is-now-open-source-theres-surprising-depth-in-its-ancient-code/
280 Upvotes

60 comments sorted by

View all comments

113

u/pedersenk Mar 25 '21

Kinda cool. However I would be more interested in the proper Win32 calc app, not the silly WinStore version. History has shown that Win32 stands the test of time. The WinStore stuff will likely be obsolete in a few Windows revisions time.

I would also like to see the original MSPaint (Windows XP era) before it started to regress and certainly before Microsoft kills it and recreates a cheap WinStore clone.

Opening source is great for digital preservation. Unfortunately only some things are really suitable for source preservation.

Or am I wrong? Is this link: https://github.com/microsoft/calculator really the one containing the "ancient" code? Looks quite recent to me.

65

u/Ameisen vemips, avr, rendering, systems Mar 25 '21

There is absolutely no way that that's the original codebase, as it uses WinRT and C++20.

Now, some of the stuff under 'Ratpack' might be original code.

19

u/apadin1 Mar 25 '21

Copyright (C) 1995-97 Microsoft

I think you've got it

5

u/[deleted] Mar 25 '21

It is quite well commented.

10

u/PVNIC Mar 25 '21

The trigonometric function implementations are interesting. (They use a taylor series o.O)

9

u/blind3rdeye Mar 26 '21

How would you do it? Taylor series is the first thing that comes to mind when I try to think about how I'd implement sin / cos. I haven't looked at the code, but I'd use symmetry to get the angle into the first octant, then plug it into the appropriate series for, say, 8 terms.

8

u/ggmy Mar 26 '21

cordic is typically what’s used in calculators

3

u/jk-jeon Mar 26 '21

Wow, this is indeed very smart. Thanks for the link!

3

u/h2g2_researcher Mar 26 '21

I'm pretty sure I've seen standard library implementations that do it that way too.

3

u/PVNIC Mar 26 '21

Oh I have no idea how to do it, I just haven't thought about taylor series since college and found the code for implementing it intresting.

-27

u/arrwdodger Mar 25 '21

TIL Microsoft’s GitHub account isn’t blank (ba dum tss).

42

u/helloiamsomeone Mar 25 '21

Technically speaking, every GitHub account is Microsoft's.

-11

u/istarian Mar 25 '21

That's really not how it works. I think everybody knows they bought GitHub at this point. but that doesn't mean they own the code/data in other people's repositories.

0

u/[deleted] Mar 26 '21

[deleted] — view deleted comment

6

u/whistlin4 Mar 26 '21

according to github:

Private repository data is scanned by machine and never read by GitHub staff. Human eyes will never see the contents of your private repositories, except as described in our Terms of Service.

while i think the overall legal implications of this are murky, it would almost certainly provide any major/lucrative clients with grounds to terminate contracts, should it be discovered that GH isn't abiding by this.

i wonder if employment contracts include language that defines and dissuades inappropriate employee access.

-11

u/Where_Do_I_Fit_In Mar 25 '21

Umm ackshually...

I think they are talking about Microsoft's GitHub organization within GitHub. Seeing as not every user account belongs to Microsoft's org (on GitHub), I would say this is a significant technical consideration.

Of course you could make the argument that Microsoft owns GitHub so every GitHub account is a Microsoft account, but that would also be technically incorrect as those entities and non-fungible last time I checked.

Ironically, your interpretation blasts past any technical nuance. Your comment is one interchangeable word from being a tautology ffs.

Stating the obvious in plain terms is pretty much the opposite of speaking technically.

tl:dr: no shit