[PHP4BETA] Re: IS_* macros
| From: | Zeev Suraski | Date: | Mon, 10 May 1999 23:26:41 +0000 |
| Subject: | [PHP4BETA] Re: IS_* macros | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-747@lists.php.net to get a copy of this message | ||
At 00:02 11/05/99 , Andrey Zmievski wrote:
Is there any reason the IS_* macros were defined to have sequential values instead of multiples of 2 like php3?It's for memory performance reasons. There was no real reason to use bit fields for the variable type. With PHP 4.0, there's almost never a reason to do that (especially your particular check for seeing whether a variable is either an array or object, now that the low level representation of objects and arrays is entirely different). Since we now have over 8 types, and since we can only allow a single byte for the size of the variable type, using bit fields is no longer an option. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il -- PHP 4 Beta#define IS_LONG 1#define IS_DOUBLE 2 #define IS_STRING 3 #define IS_ARRAY 4 #define IS_OBJECT 5#define IS_BC 6 /* for parser internal use only */ #define IS_BOOL 7#define IS_RESOURCE 8 #define IS_CONSTANT 9 #define IS_METHOD 10 /* for overloaded function calls */ and php3 had #define IS_LONG 0x1 #define IS_DOUBLE 0x2 #define IS_STRING 0x4 #define IS_ARRAY 0x8 #define IS_USER_FUNCTION 0x10 #define IS_INTERNAL_FUNCTION 0x20 #define IS_CLASS 0x40 #define IS_OBJECT 0x80 It was so much more convenient to check if the variable was not array or object by doing: if (!(value->type & (IS_ARRAY|IS_OBJECT)) and with current macros you can't do that now. Can that be changed?