In Star Trek Discovery S1:E3 (Context is for Kings), Sonequa Martin-Green (Michael Burnham) is not welcome on the U.S.S. Discovery after her mutiny moment. And to make the former number one feel that she is no number at all anymore, Anthony Rapp (Paul Stamets), Science Officer and Chief Engineer, assigns her a debugging session on his pet project. It turns out that Vulcan education prepares you well to face whatever space can throw at you. After what seems to be a multi-hour session, she found a bug! But why did the production team use Win32 code?

It is true that we still have COBOL code running these days, so it is plausible that in 2255 we still have Win32 code running on a spaceship. It may also be a premonition about the success of Window’s S-mode 😉 Now, to the code. Production team, you deserve an F. Not only all the code is commented out, but it is an awful mix of prototypes and barely C code. The bug – highlighted in red – want you to believe that it loads a pointer with the address of the NtSetInformationFile function from NTDLL.DLL (why using obscure variable names v5, v4? – but to be honest, we prefer not to know), and if it is not NULL (thank you for checking), it calls … well nothing, it would not even compile! Ok, maybe it is an example showing how you can shoot yourself in the foot in C by assigning a value to a variable instead of testing for equality while not paying attention, but even that … it just won’t compile.

IMG_1439

This is disappointing if you compare this goof to the high quality of the production otherwise. Well, at least, we can say that Paul Stamets takes it quite well. After all, screwing up some pseudo-file manipulation code in a quantic simulation code doesn’t hurt as much as a screwing-up the use of a Toffoli gate.

MV5BMTcwMDk3NTIyNl5BMl5BanBnXkFtZTgwNDMxNzg5MjI@._V1_SY1000_CR0,0,564,1000_AL_MV5BNjMzNDYwMjM1OF5BMl5BanBnXkFtZTgwODYzMzEwMzI@._V1_SY1000_SX750_AL_