HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Defining a function as constant.

12-13-2003, 11:26 PM#1
weaaddar
Whats the purpose of doing this? Is there one?
12-14-2003, 12:13 AM#2
Vidstige
I think that it is supposed to mean that the function always returns the same value. It could very well return different values each time, but then it would break its promise.

Was that correct AIAndy?
12-14-2003, 07:17 AM#3
KaTTaNa
I don't know if you can define your own constant functions, or if a constant function is better than a non-constant function in any way.
Constant functions cannot make calls to non-constant functions or access non-constant globals. That's the only difference I know of.
12-14-2003, 10:13 AM#4
AIAndy
http://www.wc3campaigns.com/forums/s...threadid=11715

That thread is pretty old so they might have changed it but I doubt so.

In the end there is no real use to constant except from a design point of view.
12-14-2003, 11:16 PM#5
weaaddar
Okay, because I was looking over pepars heap functions and he kept defining functions as constant and I've no idea if this was better memory wise or anything.

Thanks for informing that it was purely stylistic.