PHP: a fractal of bad design (fuzzy notepad)
Posted Apr 17, 2012 19:21 UTC (Tue) by
nix (subscriber, #2304)
Parent article:
PHP: a fractal of bad design (fuzzy notepad)
It's an impressive condemnation of the mass of horrible misdesign which is PHP, but I was most impressed by this evidence of the grotesqueness of the internals.
Because when trying to avoid integer-overflow bugs, the right solution to detect an input that will wrap at INT_MAX is to compute the size of your memory regions using floating point! (Sure, malloc() still takes a size_t, but I'm sure it'll be able to allocate a floating-point number of bits anytime soon. Just wait.)
(In their defence, they did fix this once they were embarrassed about it in public... but nobody writing code for public consumption should commit horrors like that. Nobody.)
(
Log in to post comments)