zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: hzoli@cs.elte.hu (Zoltan Hidvegi)
Cc: zsh-workers@math.gatech.edu
Subject: Re: Option reorganisation, Part IV.
Date: Mon, 30 Dec 1996 10:33:15 +0000 (GMT)	[thread overview]
Message-ID: <28533.199612301033@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199612272302.AAA01453@hzoli.ppp.cs.elte.hu> from "Zoltan Hidvegi" at Dec 28, 96 00:02:25 am

Zoltan Hidvegi wrote:
>After this patch the optns array is no longer used.  Loops over this array
>are replaced with scanhashtable and scanmatchtable calls.

But it *is* used.  It has to be used to insert the initial options into
the hashtable.  Any use of it after that we get for free, so there's no
reason not to look up the flags and so on there.  And walking through
the table is faster than scanhashtable(), for those functions that need
to look at all the options.

>After this patch it'll be quite easy to add new options dynamically.

But do we *want* to?  I don't like the idea of options that can't be
set until the appropriate module has been loaded.  And autoloaded
options would be silly, and would cause unnecessary module loading.  I
think options should really affect only the core functionality.
Anything else can use command line switches or parameters.

You store aliases in a manner that requires a second name lookup, but
it's easier and more efficient to store the actual option number.  (And
the way you handle the structures with the union is not strictly
conforming, and quite likely to break on 64-bit machines using the LP64
model.)  I don't see the point in doing this.

You also changed the {z,k}shletters arrays to be of the enum type,
rather than short.  This is a bad idea.  On 32-bit machines the enum is
most likely larger -- if we really want the extra speed in table
lookups we should be more sure of it by using int.  More importantly,
the enum could be unsigned, but the table contains negative values.
And there are probably some compilers that would warn about the use of
a value that is not one of the enumeration constants.  (For these
reasons, I *never* use an enum as a type.)

-zefram


  reply	other threads:[~1996-12-30 11:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-27 23:02 Zoltan Hidvegi
1996-12-30 10:33 ` Zefram [this message]
1996-12-30 15:53   ` Zoltan Hidvegi
1996-12-31 12:27     ` Zefram
1997-01-01 17:57       ` Zoltan Hidvegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28533.199612301033@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=hzoli@cs.elte.hu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).