2016-08-29-2177590

today we were discussing different spacecraft accidents caused by/related to software, discussed Arian-5 case, and I remembered a Soviet case, where there was a problem with decimal separator and Fortran compiler. Decimal separator in USSR was comma, but in Fortran code it should be the dot.

Also, Fortran compiler did not consider using comma instead of the dot as an error, but as different code. And my friend said - the same is possible to do in C++ - and sent me the illustration.

#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
if (1,2!=1.2)
{
cout << (1,2) << endl;
}
return 0;
}

if you run it, you’ll get

Hello World
2

(:

#safety #programming #mistakes #safe #c++ #code #example #programming-languages #programming_languages #arian #fortran #source

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)

պիտակներ՝ include  safety  programming  mistakes  safe  c  code  example  programming-languages  programming_languages  arian  fortran  source