Re:Why I Write Games in C (yes, C)
by unnouinceput on Sunday September 22, 2019 @08:52AM
(#21041138)
While Pascal is indeed strong typing and C is weak typing, casting is allowed on both at compile time and introducing bugs this way is not going to be stopped by compiler. Here is what a compile will behave in C vs Pascal:
C code:
int i = 1; char s = "1";
{
if (i == s) //<--- this will be allowed by compiler in C because C is weak typing, and will comeback later to bite you at runtime
{
//bla bla
}
}
Pascal code:
var
i : integer = 1;
s : string = '1';
begin
if i = s then begin //<--- this will not be allowed by compiler in Pascal because Pascal is strong typing
//bla bla
end;
end.
Then THINGS happen.
BAD things.