Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61674 invoked by uid 1010); 10 Jun 2005 20:35:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 61658 invoked from network); 10 Jun 2005 20:35:39 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 10 Jun 2005 20:35:39 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:50607] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 0D/BF-18818-A99F9A24 for ; Fri, 10 Jun 2005 16:35:39 -0400 Received: from baumbart.mbo (dsl-082-083-251-251.arcor-ip.net [82.83.251.251]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id EC50A35C1CF; Fri, 10 Jun 2005 22:48:23 +0200 (CEST) Date: Fri, 10 Jun 2005 22:37:35 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <100574730.20050610223735@marcus-boerger.de> To: Jaap van Ganswijk Cc: internals@lists.php.net In-Reply-To: <6.2.1.2.2.20050610091349.0aff2c00@localhost> References: <200506052048.58029.johannes@php.net> <1558647963.20050606083713@marcus-boerger.de> <6.2.1.2.2.20050610091349.0aff2c00@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] incrementing boolean values From: mail@marcus-boerger.de (Marcus Boerger) 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:mail@marcus-boerger.de