Raised This Month: $51 Target: $400
 12% 

Better way to declare in loops


Post New Thread Reply   
 
Thread Tools Display Modes
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 01-26-2016 , 09:27   Re: Better way to declare in loops
Reply With Quote #31

Quote:
Originally Posted by h3bus View Post
Is that because scripters can make mistakes with it?

Or is there another reason, because this one isn't a good reason at all.
It can cause crashes if not used properly, I assume its safe to use if you know what you are doing, although I might be wrong.
SM9 is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-26-2016 , 12:47   Re: Better way to declare in loops
Reply With Quote #32

There is nothing wrong using decl if it is done so properly. Most computer languages support this feature.

The problem is many people fail to initialize the data, usually because the return from the function they try to set it with fails and then does not set it, or they have some case in their code where it gets used without being set.

In most cases it does not take much time to just initialize the data, so it is decided by the am team to be better practice to always initialize the data.

A good example of using decl would be to make an array with 64 cells, and add player indecides to it, incrementing a counter each time. Data after the counter does not need to be initialized. Sorting and such benefits from this too. While it is small in speed since it just skips a few instructions, when doing often like in loops, it does make a difference.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 01-26-2016 at 12:49.
friagram 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 02:04.


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