Req #39533 [Wfx->Opn]: ord() cast with (unsigned char), chr() with (signed char)

From: Date: Fri, 09 Jan 2015 00:37:09 +0000
Subject: Req #39533 [Wfx->Opn]: ord() cast with (unsigned char), chr() with (signed char)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189804@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=39533&edit=1 ID: 39533 Updated by: ajf@php.net Reported by: fred at cashette dot com Summary: ord() cast with (unsigned char), chr() with (signed char) -Status: Wont fix +Status: Open Type: Feature/Change Request Package: *General Issues Operating System: * PHP Version: 5.2.0 Block user comment: N Private report: N New Comment: Wait, I think I misunderstood. You want chr() to cast to unsigned char? There might be a case for that. Oops. Previous Comments: ------------------------------------------------------------------------ [2015-01-09 00:35:55] ajf@php.net Making ord() produce a signed char would make it inconsistent across platforms, as whether char is signed or not varies. Plus, people are pretty used to it being unsigned. ------------------------------------------------------------------------ [2006-11-16 14:54:43] fred at cashette dot com Description: ------------ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?revision=1.445.2.14.2.28&view=markup&sortby=date PHP_FUNCTION(ord) ... RETURN_LONG((unsigned char) Z_STRVAL_PP(str)[0]); .. PHP_FUNCTION(chr) ... temp[0] = (char) Z_LVAL_PP(num); would not like use (unsigned char) in PHP_FUNCTION(chr) ? or opposite ? ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=39533&edit=1

« previous php.bugs (#189804) next »