George George - 1 year ago 76
C++ Question

Why is there no semicolon at the end of this call to `initShaders()` (OpenGL/C++)

Consider the following snippet of code from an OpenGL tutorial:

int main()
initShaders() //why is there no semicolon on this line?
return 0;

Why is there no semicolon on the call to
? Does that mean this is a macro call?

Answer Source

It's a typo. In C++ using clang++ this would not compile and throw the following error.

error: expected ';' after expression

There is a small possibility that it is a macro, but I doubt it, and that would be a very unconventional, i.e., bad way of writing one.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download