Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12940 invoked from network); 7 Mar 2015 17:35:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2015 17:35:15 -0000 Authentication-Results: pb1.pair.com header.from=sbj.ml.read@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=sbj.ml.read@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.174 as permitted sender) X-PHP-List-Original-Sender: sbj.ml.read@gmail.com X-Host-Fingerprint: 209.85.223.174 mail-ie0-f174.google.com Received: from [209.85.223.174] ([209.85.223.174:37623] helo=mail-ie0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/92-29230-1D63BF45 for ; Sat, 07 Mar 2015 12:35:14 -0500 Received: by iebtr6 with SMTP id tr6so20184498ieb.4 for ; Sat, 07 Mar 2015 09:35:11 -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=RMEuVPUwxCBSwsxvq9uUxLeipojvRkf7CrMcR2C90fk=; b=GG+cVD3HZtZBRXQEcWH09437usFX5eKHvYZ5k20fxRGpanDfLSvSrXN5whnCld0JJc frRElmVH7ZASqn1bWyOPRHbzYbTue9u82HdRzDs5AqWJ66hJE9dcWZKofRW2a/7CmCzW gUbxjNX8yVOtlnLxksk92PkCtP08dcaHFdCQ2fjaK0ma9FlepccGjwYfHBYuu5zh7qC5 /8t3004DB+WBpim5/WYCtbA9jbWskEEx3FLkLHo1UuQ0LtTAgzMVkccxkEq5MU1iXS6m OdTA7ykwKiyQaRGsi2DyO1uXgHRgzsTMIXmDPCpyOYdzbE52js0vbuZACHW/50UALth6 lI3g== MIME-Version: 1.0 X-Received: by 10.42.90.133 with SMTP id k5mr16819816icm.91.1425749711256; Sat, 07 Mar 2015 09:35:11 -0800 (PST) Received: by 10.107.29.205 with HTTP; Sat, 7 Mar 2015 09:35:11 -0800 (PST) In-Reply-To: References: Date: Sat, 7 Mar 2015 18:35:11 +0100 Message-ID: To: Kalle Sommer Nielsen Cc: reeze , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [Discussion] Deprecate function sizeof() From: sbj.ml.read@gmail.com ("Sebastian B.-Hagensen") Hi, 2015-03-07 17:41 GMT+01:00 Kalle Sommer Nielsen : > I'm a big -1 on this, while I know it returns the memory size in a C > perspective, I think it makes perfect sense to remain an alias, it > would break lots of applications for a very tiny to nothing gain. I don't think the alias make sense and is really misleading and I've seen sizeof("abc"); often enough (Don't get me wrong that's equally bad with count, but sizeof encourages that usage, imo). Having two functions that do exactly the same using different names for no good reason (one of them referring to a different operation in a more popular language) isn't optimal. Code using a deprecated sizeof call is trivial to fix. But:. I'm not sure if the cost involved is really worth it, after all some big projects enforce sizeof over count and github returns over 1.2m results for sizeof+php (many false positives from html files documenting c code etc., still a huge number) . Random first two projects with over 500 stars/or big installation base I found: http://area51.phpbb.com/docs/31x/coding-guidelines.html#general : "Use sizeof instead of count" https://github.com/atoum/atoum/blob/master/CC.md#arrays : "To get length of an array, use sizeof instead of count (no technical reason about that, it's just the current convention)". On the other side: Removal of sizeof is doable with a patch release for almost all projects and shouldn't really require more than 5 to 10 minutes (+ time to review the diff) for most projects.