In one of the files of the Direct X Samples "MiniEngine" ( https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/MiniEngine ) I found this line that confused me:

void CameraController::Update( float deltaTime )
{
    (deltaTime); // <-- here
    …
}

At first I thought it was something to make the compiler stop complaining about an unused parameter, but it is used further down anyway. I can only think it is some sort of performance optimisation somehow, but I can't think what.

Can anyone enlighten me? It could always be a new C++ thing I don't know about :) I haven't played with C++ for about 10 years.

1 Answers

2
Community On

As you wrote, it may be used to mute warnings about unused variable, however it would be better if it was written:

(void) deltaTime;

That should mute warnings on most (if not all) compilers.