Raised This Month: $ Target: $400
 0% 

Sizeof Operator?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 07-31-2008 , 14:12   Sizeof Operator?
Reply With Quote #1

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?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-31-2008 , 16:07   Re: Sizeof Operator?
Reply With Quote #2

I was told that it is a normal operator and not a pre-compiler directive.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 07-31-2008 , 22:52   Re: Sizeof Operator?
Reply With Quote #3

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
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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