Hello Jaap,

Friday, June 10, 2005, 10:01:10 AM, you wrote:
> NULL comes from C I think and stands for an uninitialized
> pointer. There is no other way to empty a pointer except
> by using 'pointer=(*char)0;', using NULL is more clear.

you shall never cast 0 to anything since 0 matches any pointer.
Casting it would result in a typecast error or an unneccessary
casting. Thus #define NULL 0 is the only way. But that apart :-)

> Instead of filling a variable with a null pointer one
> can unset() a variable in PHP.

> I have no problems with integers and strings being
> promoted to booleans, except for example that an
> empty string is considered to be false and even
> (in some versions?) a string containing '0' or even
> 'false' or even 'NULL'?

> I like to write:

> while (fgets($hf)) {
> }

> But this fails when an empty string is considered to be
> false. BTW. the behaviour also depends on the fact if
> "\r\n" is considered to be empty or not.

Yes you definitively come from C.

(...)

> BTW. Wouldn't it be a good idea to split this
> mailing list in a list about the definition
> of the PHP language and the implementation and
> versions etc.?

We had that before and theoretically there are more lists which nobody
uses anymore. And then i think it is a very good idea that the developers
get feedback. There is a lot of noise but still a fair amount of really
good mails here that help direct the way PHP evolves.

>>Not promoting types would mean adding false++, and true-- doesn't it?

> false is a constant and can't be increment.

It was a shortcut for $a=false; $a++; $b=true; $b--; of course. However
the shortcut is much easier to get.

> When you are in favor of incrementing booleans
> you should also be able to increment a veriable
> with the value true, but should it become false,
> 0 or 2 or stay the same?

Since PHP conversion magic: true+1 => 2; false+1 => 1; 1+1 = >2

(...)

BTW, Nice commenting on the: ($p=strpos())++

Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to