bin/71623: [PATCH] cleanup of the usr.sbin/pcvt code

Giorgos Keramidas keramida at freebsd.org
Mon Sep 13 02:20:20 PDT 2004


The following reply was made to PR bin/71623; it has been noted by GNATS.

From: Giorgos Keramidas <keramida at freebsd.org>
To: Dan Lukes <dan at obluda.cz>
Cc: bug-followup at freebsd.org
Subject: Re: bin/71623: [PATCH] cleanup of the usr.sbin/pcvt code
Date: Mon, 13 Sep 2004 12:10:54 +0300

 On 2004-09-13 08:48, Dan Lukes <dan at obluda.cz> wrote:
 > Giorgos Keramidas wrote:
 > >>>>!     if (kbdc < 32) printf("  %s", ckeytab[(short int)kbdc].csymbol);
 > >>>Does the value really have to be a (short int) here?  Wouldn't an (int) be
 > >>Because kbdc is type of char. Short int should be sufficient for char.
 >
 > > Apparently there's no special reason why this value should be
 > > `short' and not `int', so keeping the existing practice of using an
 > > `int' for holding a `char' value is what my suggestion was about.
 >
 > When sizes aren't equal then compiler must emit an conversion code.
 >
 > Well, I'm understand now that nobody here cares about a few bytes of
 > memory or tenths CPU ticks. Some of my programmesr skills came from
 > ancient days, so every byte and ticks seems to be valuable for me. But
 > no problem for me to adapt to todays programers practices ... ;-)
 >
 > If existing practice want int here we should use int.
 
 I'm far from the best person to ask for a definition of today's "canonical
 programming practice", but I'm trying to learn too.  After reading parts of
 the FreeBSD source tree I've learned a tremendous amount of things and I
 still do learn every day.  Influences by others are obvious too in the way
 I think and work though.  One of the most influencial persons whose work
 I've admired is Donald E. Knuth, who has said:
 
     "We should forget about small efficiencies, say about 97% of the time:
     premature optimization is the root of all evil." -- Donald Knuth
 
 This is why I think that this sort of micro-optimizations are not worth a
 lot of trouble or time.
 
 Of course, this doesn't mean that I don't want you to keep improving the
 source of FreeBSD.  I'm just vehemently opposed to optimizations done to
 tweak a machine-cycle here, a byte there, a single word of memory there,
 etc. by sacrifizing clarity, style and cleanness of the source or, for
 instance, by introducing dependencies to the way a specific compiler works.
 
 But I'm probably beginning to sound like an insufferable pedant.  Off to a
 bit of hacking :)
 
 Regards,
 
 - Giorgos
 


More information about the freebsd-bugs mailing list