Date: 02/27/99
- Next message: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Previous message: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- In reply to: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Reply: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 27 Feb 1999, Rasmus Lerdorf wrote:
> > > Resources use hash tables to store themselves, and they usually use the
> > > numeric indices. I think it's extremely safe to use 32-bit integers as
> > > unique identifiers for 64-bit pointers, by simply casting them. You'd
> > > have to be extremely unlucky to bump into a problem because of this data
> > > loss. Your chances of winning the lottery are much much bigger.
> >
> > I disagree here. The chance of having the same ptr in 32 bit is about 1 in
> > 2^32 = 4,294,967,296. If you come to Germany, your chance to win the lottery
> > ("6 aus 49") is about 1 to 49!/43! = 10,068,347,520.
> >
> > It's extremly safe, but you risk random, non repeatable crashes produced by
> > playing that way.
>
> Would there be a big drawback to using a long here instead of an int for
> unique identifiers?
It doesn't change things really. The chances anybody will ever notice a
problem are, as it is, pretty much non existnant. Changing it to be
'long' doesn't make it any more correct than it is now, it just gives you
64-bit safety instead of 32-bit safety (since there's no provisions
sizeof(long)==sizeof(void *)). I'm happy with 32-bit safety as it is, I
don't mind changing it to be a long in PHP 4.0, but I definitely don't
want to start playing with that sort of stuff in the production PHP 3.x
tree.
Zeev
--
-----------------------------------------------------
Zeev Suraski <zeev <email protected>>
For a PGP public key, finger bourbon <email protected>
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Previous message: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- In reply to: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Reply: Rasmus Lerdorf: "Re: [PHP-DEV] PHP3 and 64-bit land"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

