Re: [RFC] Reclassifying engine warnings
| From: | Christian Schneider | Date: | Thu, 29 Aug 2019 17:24:29 +0000 |
| Subject: | Re: [RFC] Reclassifying engine warnings | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106806@lists.php.net to get a copy of this message | ||
Am 29.08.2019 um 18:25 schrieb Aegir Leet <aegir@aegir.sexy>:
> Before reading the responses to this thread, I had honestly never
> encountered a PHP developer who thought using uninitialized variables
> was fine.
Now you have. Nice to meet you.
> I knew it worked, but I always considered this to basically be
> the PHP equivalent of undefined behavior in C. And I don't think anyone
> would get mad if a new GCC version broke the way they were abusing UB.
That's where you are mixing things up: It is well-defined behaviour, even if you personally
don't like it.
A better analogy is static variables in C. It is common (and not considered bad) practice to not
explicitly set a variable to 0 as that is the default value.
Example: https://github.com/git/git/blob/6d5b26420848ec3bc7eae46a7ffa54f20276249d/delta-islands.c#L26
- Chris