help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libfl.a and common code


From: Bruce Lilly
Subject: libfl.a and common code
Date: Wed, 16 Apr 2003 14:23:20 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312

In flex with the reentrant option and multiple lexical analyzers,
there are multiple functions with different names but identical
code.  For example, if there are lexical analyzers with prefixes
a, b, c, ..., there will be multiple functions
aget_out, bget_out, cget_out, ...
aset_out, bset_out, cset_out, ...
alex_init, blex_init, clex_init, ...
alex_destroy, blex_destroy, c_lex_destroy, ...
etc., each set having absolutely identical code.

Such duplicate code adds unnecessary bulk to a project and fails
to take advantage of potentially common code for execution speed
(e.g. cache hits).  Wouldn't it be better to have a single set of
functions with the yy prefix and contained in libfl.a?

Of course, where code is not identical, e.g. yy_scan_buffer,
separate functions are necessary.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]