Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71945 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77082 invoked from network); 1 Feb 2014 21:16:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2014 21:16:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.171 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.217.171 mail-lb0-f171.google.com Received: from [209.85.217.171] ([209.85.217.171:48021] helo=mail-lb0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/F7-30967-E246DE25 for ; Sat, 01 Feb 2014 16:16:31 -0500 Received: by mail-lb0-f171.google.com with SMTP id c11so4473937lbj.30 for ; Sat, 01 Feb 2014 13:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=qCPJ5kAbDqwj0Uaeg5oWeu148ZnJBu3Zk790YJyItVI=; b=KTSZFp6JCMI0WYYz3pbUWQlksIbyqyfZB1LmA/OkyNY1ASHHC16Q1338LKAjZcI9eM AwZ90lk+iVVCn5LpSmNxi0nfSSBYvLnBr71sjQwOmz/ECN66UY8yE0orahpAKl0quGO/ f6ZFmGexMz9/eBWZ38CMqlyhQLtOqJbKNwU1ALnXtehbDYsVwapOqp7yiF6nYfFEWJgA a0BcpRxPdSTxp0CKyf4YdzKBsGTlHHBZjb6lBBfPW6C9gGPArBl64Y214via7Yn1csut qRWFC/nlpwpjUNbUL2qLlPbhs9nWRJZMXfh+qVd0PB0+0jNv7i1YhlSUiQeatP48Z3Qd mXrA== MIME-Version: 1.0 X-Received: by 10.112.137.65 with SMTP id qg1mr3603544lbb.7.1391289387427; Sat, 01 Feb 2014 13:16:27 -0800 (PST) Received: by 10.112.35.163 with HTTP; Sat, 1 Feb 2014 13:16:27 -0800 (PST) In-Reply-To: <52ED5FDD.8030101@sugarcrm.com> References: <52EAF181.3000907@sugarcrm.com> <52ED5FDD.8030101@sugarcrm.com> Date: Sat, 1 Feb 2014 22:16:27 +0100 Message-ID: To: Stas Malyshev Cc: Derick Rethans , Anatol Belski , PHP Developers Mailing List , Matt Ficken , "Stephen A. Zarkos" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [VOTE] 64 bit platform improvements for string length and integer From: pierre.php@gmail.com (Pierre Joye) On Sat, Feb 1, 2014 at 9:58 PM, Stas Malyshev wrote: > Hi! > >> There is a massive misunderstanding about the options provided in the votes. >> >> If the option #2 and #3 are accepted, only, I repeat, only the >> declarations of the variables used by zpp have to be changed, nothing >> else, no #ifdef, etc. > > I understand this. What is worrying me is that if you fail to do that > for some function, you end up using wrong variable type, and it would > lead to bugs that, from experience, are *very* hard to catch. If you > break the code explicitly, it plants a huge red flag saying "Here! You > need to fix this!". But if you just silently accept wrong types (and zpp > has no way of doing typechecks) then your best red flag would come in > the form of a user complaining "my PHP server crashes under the high > load with PHP 5.6". > I.e. if you do zpp("s", &char_ptr, &len) and zpp now expects len to be > size_t but you keep it declared as int, no tool will alert you and > you're putting 64-bit value into 32-bit stack slot. > >> It can be automated for zpp, it is almost the case already and Anatol >> is working on this part to fully automate zpp changes (with option #2 >> and #3). > > The bad part is not zpp. zpp is the easy part. Very easy even, the replace.php will take care of this part. > The bad part is all vars > outside zpp and keeping them all in sync. > >> I will prepare a sample ext compiling using 5.3, 5.4, 5.5 and with the >> int64 branch, it will be a better example than what we can see in >> mongodb, which does not use option #2 and #3. It is basically bad as >> many of us only focus on this constellation and totally ignore these >> options which were added as a possible very good compromise. > > I'm not ignoring that option. On the contrary, it is exactly that option > that you describe that I am worried about. And I am worried about it > exactly because since you don't have (meaning, forced by the compiler or > by zpp failure) to make the changes in all functions, it's all too easy > to miss one, and missing one is all to hard to figure out. That's where the compiler warnings/errors come to the game. Except for the situations where one does explicit bad casting, which should be avoided in the 1st place, if possible. That being said, I have been advocated warning free php-src for years now. I think if we ever start php6 then we should really change our policy and get clean codes. Any warning can produce undefined behaviors or changing behaviors. Using gcc and VC as base should put us on the safe side. Both gcc and vc latest versions have new options to actually get rid of many of the issues you are describing easily. Cheers, -- Pierre @pierrejoye | http://www.libgd.org