whats better
#1

What would be better?:

To create many "new" or f*ck it all under enums ?

pawn Код:
new bla;
new bla2;
new bla3;
etc with new
or this would be faster, more compact

pawn Код:
enum
{
bla,
bla2,
bla3,
bla4,
etttccc
}
Reply
#2

Declarations aren't the same things as enum's.

You would need a double array for a enum, and yet what would you fill out for the first array i.e playerid.

Just use 1 declaration, but with many commas separating them.

I.e. new i, e, f, u, j, k;
Reply
#3

Well, if you are using an enum just like that (for constants) than that is undoubtedly the best route to take.

If your planing on shoving it in an array and simply made a small snytax error, then the answer changes. Variables are faster to access than arrays are, but the answer to "which is better" really depends on much work you are willing to put in for this small speed difference, and really what your variables are used for.

Here's the speed order from fastest to slowest

Quote:
Originally posted by: ******

* Nothing
* Constants
* Variables
* Arrays
* Native functions
* Custom functions
* Remote functions


Quote:
Originally Posted by The Toni
Посмотреть сообщение
Declarations aren't the same things as enum's.

You would need a double array for a enum, and yet what would you fill out for the first array i.e playerid.

Just use 1 declaration, but with many commas separating them.

I.e. new i, e, f, u, j, k;


That is simply not true at all, you can shove an enum into an array with a single dimension.
Reply
#4

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Well, if you are using an enum just like that (for constants) than that is undoubtedly the best route to take.

If your planing on shoving it in an array and simply made a small snytax error, then the answer changes. Variables are faster to access than arrays are, but the answer to "which is better" really depends on much work you are willing to put in for this small speed difference, and really what your variables are used for.

Here's the speed order from fastest to slowest









That is simply not true at all, you can shove an enum into an array with a single dimension.
Ah, looks like I learned something today. Wouldn't it be a little weird to use single arrays with enum's?
Reply
#5

Quote:
Originally Posted by The Toni
Посмотреть сообщение
Ah, looks like I learned something today. Wouldn't it be a little weird to use single arrays with enum's?
I dont see how. It would be exactly the same as using it in a multidimensional array. Lets say you have an array filled with all your server information (Players,objects,vehicles, etc) is it not easier to use the names than to remember an array index?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)