[Oberon] Bluebottle empty String check

Bernhard Egger bernhard at aces.snu.ac.kr
Tue Sep 20 03:43:01 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Witch solution is more convenient, as machine code generation?
> 
> str: Utilities.String;
> 
> IF str^ # "" THEN
> or
> IF str[0] # 0X THEN

if you use Builder.Compile to compile your code both versions are equal:
array bound check for 0 plus character comparison

if you use Paco:
IF (str^ # "") THEN
is compiled as a string comparison, i.e. both strings are compared until
they differ or the end of the strings is found.

IF (str[0] # 0X) THEN
is compiled as a simple character comparison (array bound check plus
character comparison)

- -> IF (str[0] # 0X) is compiled well on both compilers, whereas the
other version is slightly slower when compiled with Paco.

Bernhard
-----BEGIN PGP SIGNATURE-----
Comment: Public key at http://pgp.mit.edu/

iD8DBQFDL2kllUmaCwWcOxMRAkMMAKCKlS/MAgj31a59Vy/6je86doEDaACfat2M
kBcUYsMnxEjLdqSAxTZqI/g=
=rDIP
-----END PGP SIGNATURE-----



More information about the Oberon mailing list