{ T* p = new T;
Dll_fn_takes_by_Copy (p);
delete p;
}
Show me how.
A language change only helps people avoid mistakes if it does so
automatically or with significantly greater convenience than they
already have. Your suggestion only helps people who are careful in
their coding, and those people are already careful and don't make the
mistakes that your change could prevent.
If you want to help less careful programmers avoid mistakes, campaign
for std::unique_ptr and friends to have validity checking on
dereference, throwing exceptions on null pointers. (The campaign
wouldn't work because people don't want that extra overhead.)
I understand why everyone is on the defensive, and I agree totally that we should not obstruct the smart pointer campaign.
But library implemented and low level will definitely use raw pointers....just show me how many std::vector implementation uses smart pointers for its internal data pointer.