Re: Simple Slots Reservation
Quote:
|
Re: Simple Slots Reservation
Well, if I had one last complaint, is PLUGIN and VERSION are used three times, you should use new const here. Just better memory management. :mrgreen:
|
Re: Simple Slots Reservation
Quote:
Once i used scripting help forum and i got solution but then someone asked why i did like that and not the other way and i didn't knew why. Since that day i like to know the whys. Some people got "spammed" with stupid scripting questions :twisted: Edit: Updated! And i have a feeling that i am gonna get banned :mrgreen: |
Re: Simple Slots Reservation
It's simple, define is a preprocessor directive which is replaced during compilation. So if you #define SOME_STRING "some_string" and use it either in a function that is called frequently or on multiple places, the memory will be allocated (and free'd) each time the string is used, which is a waste of computing power (not that it really matters, though).
Where as with a constant, the memory is allocated only once when the constant is initialized and stays in memory until it is free'd. Using the constant will point to the memory rather than reallocate it, which can potentionally save memory operations at the cost of constant memory usage. |
Re: Simple Slots Reservation
Code:
After compilation, same string is replaced everywhere. Compiler allocates 3 times the same string: Code:
VS Code:
After compilation, string is allocated one time and this will use references anywhere string is repeated. Code:
Basically, if you have a string which is referenced more than one time, this is good idea to use new const EDIT: Shit, ninja'd! \o/ Though I'm not sure to agree to Quote:
|
Re: Simple Slots Reservation
Roger that, thanks both :)
Updated |
Re: Simple Slots Reservation
Quote:
|
Re: Simple Slots Reservation
While you are on it, here the french translation with accents:
Code:
[fr] |
Re: Simple Slots Reservation
Quote:
|
Re: Simple Slots Reservation
Ah. Then you should not attach it, because if file is changed upstream (which is going to be the case), people will think it's the right version and will replace it. There is no reason to attach it really. Don't bother with it. :P
|
All times are GMT -4. The time now is 01:03. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.