AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sizeof Operator? (https://forums.alliedmods.net/showthread.php?t=75164)

Drak 07-31-2008 14:12

Sizeof Operator?
 
Is the "sizeof" operator, a pre-compiler function thingy? (Does it change it to the size of the array upon compile?)
I use "sizeof" always, when dealing with global arrays. (Incase I ever change it's size)

Is this any performance loss? Or is it all replaced when compiled?

Exolent[jNr] 07-31-2008 16:07

Re: Sizeof Operator?
 
I was told that it is a normal operator and not a pre-compiler directive.

jim_yang 07-31-2008 22:52

Re: Sizeof Operator?
 
compiler will calculate all operators which can be calculated when compiling.
such as 1<<10 sizeof ...
so when compiled, "sizeof x" appears as a const
so don't worry about the performance at run-time


All times are GMT -4. The time now is 05:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.