One of the popularly called worst parts of the C programming language is how it treats pointers and arrays nearly identically, making, for example, bounds-checked array access impossible. However, we turn the complaint on its head with the following recommendation: never use arrays in C. The motivation for the recommendation is slightly cynical, but intended to be practical: if you need such a high-level programming construct as an array, you should be using a high-level programming language, not C.
Similarly derided is the ability to cast arbitrary types into arbitrary other types, for example from void* to long int. However, once again a recommendation: all C programs should invoke such a sketchy cast at least once. If you don't need that feature, you shouldn't be programming in C.
Both of these follow the philosophy, C is a wonderful assembly language, mostly portable even.
No comments :
Post a Comment