r/GraphicsProgramming • • Aug 14 '22

Finally!!!!! Red Triangle%

Post image
330 Upvotes

27 comments sorted by

View all comments

8

u/314kabinet Aug 14 '22

Congrats! But for god’s sake, use const.

0

u/[deleted] Aug 14 '22

[deleted]

8

u/fgennari Aug 14 '22

The answer depends on the compiler. In my experience, no, it doesn't make a difference, but using some of the new C++ features such as constexpr can make a difference. The advantage of "const" is that it helps the programmer to manage object ownership, write permissions, etc. This makes the code easier to understand and reduces the chances of mistakes. Sometimes "const" is required when using libraries/APIs that enforce cons correctness.