[H-GEN] fwd: coding style

Martin Pool martinp at mincom.com
Thu Nov 4 20:07:31 EST 1999


[ Humbug *General* list - semi-serious discussions about Humbug and
Unix-related topics. ]

Interesting.

-------- Original Message --------
Subject: Re: [Jikes] unicode support
Date: Wed, 3 Nov 1999 00:15:32 -0500
From: shieldsd at us.ibm.com
Reply-To: Jikes at Watson.IBM.Com
To: Jikes at Watson.IBM.Com

Re code duplication, Philippe and I both detest conditional assembly,
and
try to limit its use whenever possible. I separated out the code. The
existing code (now called ProcessInputAscii) has been carefully
hand-crafted and tested. I really wasn't sure if all the code was needed
for the ICU case. Philippe has had some objections lately as he has seen
changes that I have committed on behalf of others that he doesn't
understand, and I felt it best to separate out the code to simplify his
maintenance burden. However, once the ICU stuff complete, it may be
worth
revisiting this. It may also be the case, as so often happens, that I
was
simply wrong, in this case by "duplicating"  code.

Philippe really likes to have lots of methods, each with its own
purpose.
I've written much more C than C++ (the bytecode generator was my first,
and
hopefully last, program in C++) and I have tended to use a traditional
approach, trying to avoid duplication (with if tests and conditional
assembly) only to get several (gentle) slaps on the wrist from Philippe.
Invariably his code has proven cleaner than mine.

For example, I happened to note today that there is a separate method
for
each error message, something I would not have done in my crochety
old-fashioned mode.

By the way, old habits die hard. There are  long-time programmers inside
IBM who go to _great_ lengths to avoid recursion, sometimes producing
ludicrous code in the process, simply because procedure call was such an
expensive operation on the 390 (nee 360) twenty or so years ago.

Though I try not to worry too much about performance, it's worth noting
that function pointers are cheap in C++. Kim Knutilla, a principal
author
of IBM's C++ compiler (and now VP of Engineering for Cygnus) menitoned
in a
conversation several years ago that using an array of function pointers
was
much cheaper on a RISC architecture than using a switch statement.

dave



To learn more about this mailing list, including disclaimers and how to
end your subscription, see http://www.ibm.com/research/jikes/subscribe .

--
This is list (humbug) general handled by majordomo at lists.humbug.org.au .
Postings only from subscribed addresses of lists general or general-post.



More information about the General mailing list