12

What is the difference between #define NAME VALUE and const int NAME = VALUE in GLSL 410 core?

As far as I can see, they both create a constant integer.

Lucien
  • 1,176
  • 2
  • 10
  • 36
  • 1
    Since glsl is based on the syntax of c, I suspect this question on SO will answer your question. – Sumurai8 Sep 07 '15 at 17:54
  • @Samurai8 thank you! Should I delete this question? – Lucien Sep 08 '15 at 17:44
  • 1
    I think this question is on-topic, but I am not all that familiar with this particular stackexchange. If the question is on-topic, it does not matter it has already an answer on a different SE site; just self-answer this question with what you have learned. – Sumurai8 Sep 09 '15 at 15:14

1 Answers1

14

#define NAME VALUE is a macro, where all instances of NAME are replaced with VALUE by the pre-processor.

The compiler handles constants. This ensures type safety.

Lucien
  • 1,176
  • 2
  • 10
  • 36