Re: C / C++ compilers and libc could do this too
But if I've allocated a and b and already verified that they are the same size, whats wrong with using strcpy?
The elephant in the middle of table table isn't when you first create this beautiful piece of software it is years down the track as it is maintained.
Some future developer changes the allocation of either a or b as they need to store a longer string. Your use of strcpy may several calls below where the change has been made and difficult to spot.
The single biggest cost with software is in the maintenance.