Nat! bio photo

Nat!

Senior Mull

Twitter Github Twitch

The idiocy of too strong typing

While perusing the Xcode Users mailing list archives I found this beauty:

I'd like to write a quick function template to change a function pointer from type " return_type (*)(void) " to "return_type (*)(...)".  I thought this would work:
template <typename RetT>
RetT (*convert_ptr(...)) ( RetT (*src)(void) ) { 
   typedef RetT (*rt)(...); 
  return reinterpret_cast(src); 
  //ERROR: "src" was not declared in this scope.
}

The whole code functionally is a big bag of nothing. It's all syntax. Spending time programming this stuff is about as worthwhile as reformatting TPS reports.

The C-solution is (or should be, if it hasn't been broken by some committee by now) convert_ptr = (void *) src , which means: I know what I am doing, don't bother me even with warnings, I have better things to do.