News for hackers. Stuff that matters.
Re:Type Safe Generic Data Structures in C by josephg on Monday October 05, 2026 @06:28PM (#49971695)
Nah. Malloc’s return type is a pointer. The memory pointed to by a malloc call is untyped. But the return type isn’t void. It’s void*, aka a pointer to unknown.

I’m mostly happy with implicit casts from void* to int* or something. But in this code example, we see an implicit cast from void* to int, casting the pointer itself into a number that might not even fit the pointer. This is rarely what you want. I’d much rather explicit casts in this case.

Re:Type Safe Generic Data Structures in C by 1718627440 on Tuesday October 06, 2026 @06:44AM (#49976639)
You're right, I failed at reading comprehension.

My understanding is that C has a different understanding of the word warning than other languages. Such as in "stern warning" or "warning: the building will collapse if you take that brick out".

This is a philosophical problem. C has false positives to the question: "Is that a program", and some people find that to be idiotic (I don't, this is why I like C). But this becomes really logical, when you have in mind, that the point is that you do not want to have false negatives.