13 comments

[ 0.24 ms ] story [ 43.9 ms ] thread
Why did you retitle this with "... or why most C coders don't get OO"? I don't see the connection.
Because the (ab-)use of void* instead of struct typedef pointers mean they do not understand C is OO and typesafe.

tl;dr: void* is a code smell.

(comment deleted)
Where in that entire article is type void* even being used?
Are we reading two different articles or what?
We must be, because all I see are pointers to "function returning void". Show me where the void pointer is.
Void pointers do have a purpose. Regardless, it's only about type safety, not being object-oriented, since C isn't.
There are no void pointers in that example. At all.

All of it builds off of `void( * )(int * )`, which is a pointer to a function taking a pointer to `int` and returning `void`.

Without void * there would be no malloc(), calloc(), free(), qsort(), etc.

More importantly, there is no void * in the article.

Even more importantly, it's a "silly puzzle" as already mentioned in the article. How do you conclude from that C programmers who love such puzzles don't understand OO? That's a very unscientific thing to say.

malloc/calloc and free are the only legitimate outliers in my opinion.

What I was getting at is that most C programmers simply do not understand programming at all and write utter trash. A lot of the stuff I've seen is failing to use type safety in C.

There is no connection.
Look, C is a PROCEDURAL language. But -- (and its a BIG but) without it, you wouldn't (easily) have OO languages.