Hacker News new | ask | show | jobs
by iopq 4095 days ago
If you add '!' to '#' you get 'D', which is non-sense in any high level language.
1 comments

Not true; you added the byte that happens to be identified in ASCII by !, 33, to the byte that happens to be identified in ASCII by #, 35, and get 68, which is D. This is all perfectly sensible and type safe, two 8-bit numbers being added to produce another 8-bit number; you are only confused by the surface syntax. There's plenty of high-level languages that will let you do this; there's all sorts of reasons to make numbers and the ASCII chars they represent easily usable for each other in source code.
No, I didn't. I actually added the character '!' to '#'. The C language doesn't DISTINGUISH characters from their numerical representations. That's where I say it's weakly typed. It does not have an actual character type, it only has 8 bit numbers.

Of course in C it is perfectly logical. I am pointing out that it is not as strongly typed as other type systems that have richer types.