helpgperf - Support: sr #108399, gperf should also generate a macro...


sr #108399: gperf should also generate a macro to calculate the hash value

Submitted by:  None
Submitted on:  Wed 25 Sep 2013 09:27:14 AM UTC  
Category: NonePriority: 5 - Normal
Severity: 1 - WishStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Wed 25 Sep 2013 09:27:14 AM UTC, original submission:

background: I use gperf for embedded development to maintain a key-value database in flash for a fixed set of variables. When I get a string from the outside world I use the 'lookup' function. A subset of the variables are never exposed to the outside world, counters, statistics and are manipulated internally. For these variables it would be very convenient to have a macro which would calculate the hash value of the known string (lookup("foo")): this would give me the index at compile time, which could be used to give (1) a compile time guarantee that I only try to look up existing strings and (2) would avoid the runtime overhead of calculating the hash for known strings.

(1) would be a pleasant property, (2) would be extremely useful to avoid the runtime overhead for a code base with hundreds of internal variables.

If there are no takers, I will probably end up doing this, in which case I'll be glad to submit a patch if there is interest.

Thanks, Laszlo Nemeth



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup