I remember when I was still in college, I asked my...
# random
c
I remember when I was still in college, I asked my C teacher how come I have to write
a.b
or
a -> b
depending on whether
a
is a pointer: the compiler already knows, why put the burden on the developer? He looked at me blankly. Never received a good answer.
r
Not really about C, but smart pointers in C++ are a good example of overloaded
operator *
, that allows one to both use it as object (
ptr.reset()
) and as a transparent pointer (
ptr->fieldOfPointedType
). As for the C itself, I'd say clarity, but automated casting and implicit
void
on functions defeats that argument.