On 06/03/2013 05:28 PM, Paul Eggert wrote:
How about the following idea instead?
Have sig2str.h export an array like this:

extern char const allsigstr[];

This would consist of a concatenation of null-terminated strings,
one per name, terminated by an empty string.

allsigstr could be initialized at compile-time, with no runtime
actions needed.  Since it's read-only and initialized it could be put into
the text segment.

The existing numname_table could remove its 'name' field,
and replace it with an integer offset into allsigstr.  This
offset could also be calculated at compile-time, so
numname_table could live in the text segment too.

Much simpler syntax than the typedef I used (and than a structure). I tried to think of a method not involving run-time array initialization, but couldn't. You're idea for use of an index in the structure rather than the actual string is a good one. Choose whatever nomenclature for "allsigstr" that makes sense.

Thanks,

Dan

Reply via email to