The unsafe code is written inside the library, which the user can contain in a safe API. With C++, the entire codebase is unsafe.