3 ms·
Strict typing afaik isn't really a formally defined, imo. As you know C is statically typed and generally said to be "weakly typed" as well but you can make a
by CriticalCathed 7y ago
Strict typing afaik isn't really a formally defined, imo.
As you know C is statically typed and generally said to be "weakly typed" as well but you can make a strong argument that just about any language is "strong" or "weak" -ly typed based on a dozen or so characteristics. I think it makes more sense to treat it as a spectrum where some languages are "stronger" than others. Which is different than in the case of "static typing" which you either have or don't.
- sgt101 7y agoOh come on, I was taught the difference between strong and weak typing with C (weak) and Pascal (strong) as the examples 30 years ago. You can cast a C entity to something else and NO ONE ELSE KNOWS. Then THINGS happen. BAD things.
- unnouinceput 7y agoWhile 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.