|
Posted by Gordon Burditt on 11/18/11 11:44
>> Macros are more efficient.
Anyone got actual PROOF that macros are more efficient in an
interpreted language? Claims that <language construct x> is
more efficient without specifying the language are almost always
false.
>> Personally, one construct I use heavily and would like to replace with a
>> macro:
>>
>> $var = isset($_POST['postvar']) ? $_POST['postvar'] . 'default value';
>>
>> I use something similar for a get/post, session and cookie values. It
>> would be very nice to have a macro.
>
>
>And tell mme again why you couldn't write a function instead of a macro to
>do that?
Let's see you implement the equivalent of the C macros:
#define LENGTH (
#define FEET ) * 12.0 + (
#define INCHES )
used as:
LENGTH 6 FEET 3 INCHES
in a PHP function. Of course, abusing C macros like that should carry
the death penalty.
Gordon L. Burditt
Navigation:
[Reply to this message]
|