You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Jan Hlavatý <hl...@code.cz> on 2004/09/01 07:39:55 UTC

Bad habits: << 0

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

I have noticed there are a lot of << 0 in the code.
While it may make the code a bit more readable,
I remind you it DOES generate unnecesary code in classfiles (two instructions).
I suggest we remove it and refrain from using it in the future.

Jan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQEVAwUBQTVgqnFDePgyse5HAQL3GAf9HE3JeNJInQdkV3Xfxq2bNa+mM1Nne+6b
zTE/iaUYZQPOsGjz1oZtsOiqW6YWO6HoFM2dtF7XrDXseMbXF8qM5BcdmxsosO+8
DgDJWhNK8uOAA2mfM5V2Lr+/32rYG6t64zptwYJ8q47cSpHgyKue6ifmfqLKjcom
IAlt9mwqO2kPVuGPl2j2aS3GGkF+bEYeTbudQE0nD0/dATkXW3IUIjVqY68eGLxC
FAhvLG20U4VEs65NN712NsghYmVO9NoZLnXe2rX6tck5vpYnzNJIhB2sU0cfT8u1
oQgTr/rzVf3wv9YJ2FEE+CKW/683tfSyh3sFFGH3WdSDFy3LuCDe+g==
=80Hl
-----END PGP SIGNATURE-----

Re: Bad habits: << 0

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jan Hlavatý wrote:

| I have noticed there are a lot of << 0 in the code.
| While it may make the code a bit more readable,
| I remind you it DOES generate unnecesary code in classfiles (two
| instructions).
| I suggest we remove it and refrain from using it in the future.
|
| Jan

Cloudscape has always used the jikes compiler for compilation and it
optimises the << 0 away in the generated byte code. Thus as a closed
source project it was an acceptable practice.

Now, I agree that since Derby is open source and javac does not seem to
optimise this away, even with -O, its use should be stopped.

Note that the jar files produced by jikes are significantly smaller than
those produced by javac. I think javac leaves unused string constants in
the .class file, I think references to classes that were used during
compilation, e.g. for bringing in static final constants.

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBNfgOIv0S4qsbfuQRAofIAKDb2lA+yd79rEvtdPApSBcd6skEpgCgn7sd
Mxzjz2hu9WkGZ4WXsTSR2SI=
=D0MD
-----END PGP SIGNATURE-----