[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature proposal: \x## notation in strings
- From: David Given <dg@...>
- Date: Tue, 10 Mar 2009 03:21:59 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Peter Cawley wrote:
> When hex is the accepted norm, it is alot easier to read hex than
> decimal. For example, in the correct content, I would recognise \x90
> and \xF4 as the x86 NOP and HLT instructions respectively. \144 and
> \244 would be much less obvious in that context. Yes, they are
> equivalent, but it is easier to write the code using the hex
> constants, and easier to read the code again later when the constants
> are in hex.
Not to mention that the hex notation follows the Principle Of Least
Surprise, which the decimal one doesn't; take the following two sequences:
\102\101\100\099\098\097
\x92\x91\x90\x8f\x8e\x8d
One of these contains a nasty surprise...
- --
David Given
dg@cowlark.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJtdzTf9E0noFvlzgRAtMJAJ9tmh0BT0gFqb6tE9AB2hVf5MtXbgCffAMh
O3l2CgVMx/N7sER//aSEkWc=
=OkbZ
-----END PGP SIGNATURE-----