kc9udx
Well, it's not like these kind of macros are exactly common. Actually one could argue that most of the time something like this is used the person doing it is either very, very clever or a total hack.
Even typeof (it's been around for pretty long in the common compilers by now) is something that should make sense once in a blue moon at best and even there a simple void pointer would work as well about 99% of the time.
From the top of my head all i can think of to have ever written where it was semi-required is some generic hash map code whose get function wants to return a pointer to the bucket containing a pointer to the actual data with the data being some random type. Naturally one would think of just returning void** but this will (unlike with a simple void*) actually yield a warning when assigned a variable of, lets say, type foo**, so the solution (without changing the function design) is to wrap the function in a macro that will deduct the data type from one of the arguments using typeof and use this to cast the returned value to the matching type.
Very, very niche stuff. I have to admit that even when a generic function could get away with simply returning void* automatically casting it to the real type having typedef deduct it from an argument feels a (tiny) bit safer than throwing around raw void* though but until now it also felt bad due to being unportable (well technically at least - the major compilers probably already supported typeof for like decades).
I sadly can't really compare it to Pascal as my memory in that regard is way to cloudy. I've always wanted to give it another go but time... and parenthesis are sadly pretty much ingrained in my brain these days. I guess i'd have quite a hard time adjusting back. It would be funny though. I figure there likely have been a couple updates since Turbo Pascal 2.0 😉
In general i'd say C users not typecasting is pretty much a myth though. At least for a lot of the more clever code. Aren't we all a little -fno-strict-aliasing
once in a while? 😃