Talk:OpenGL:Tutorials:Tutorial Framework:Particles

From GPWiki
Jump to: navigation, search

Thanks for the corrections Marijn! Not sure how I managed to compile it without stdlib.

I take it the benefit of const over #define is type checking? Doesn't that create a global variable? A 'Bad Thing' in my book.

Codehead 11:14, 13 Apr 2005 (EDT)

There isn't really a difference in my opinion, unless you examine runtime. The preprocessor turns all macros into literals before compiling, which is why they're good to use because tweaking is made easy (you don't have to replace a bunch of numbers in your code). A const on the other hand actually takes up memory as a variable. Not much difference.

And I don't see how a const would benefit with type checking, I mean don't mess up the type in the first place...

Anon. 1:32a 17 Jun 2005 (EST)

Const variables get turned into literals by the compiler, so they do not take up any more memory than defines do. I don't see how 'not messing up the type in the first place' is any kind of replacement for proper type checking, but if you really like #defines I won't stop you from using them. Marijn 03:28, 17 Jun 2005 (EDT)