Hacker News new | ask | show | jobs
by ReleaseCandidat 1651 days ago
> There's no way C can be other than marginally faster than C++

In theory `restrict` (to disallow pointer aliasing like in Fortran) could lead to optimization gains, same as not having exceptions (the possibility of exceptions prohibits certain optimizations of the C++ compiler).

1 comments

I agree; of course, both clang and gcc extend C++ with __restrict__ if I remember correctly; from what I know, there are more things that can be done in C++ to improve over C than the other way around.
IIRC, __restrict__ in clang and g++ does nothing when you write C++ code. It is there just for compatibility with C.