Skip to content

strpool_length() documentation question #66

@mondegreengames

Description

@mondegreengames

The documentation for strpool_length() says this:

Returns the length, in characters, of the specified string. The resulting value is only valid as long as no call is made
to strpool_init, strpool_term, strpool_defrag or strpool_discard. It is therefor recommended to never store the
value, and always grab it fresh by another call to strpool_length when it is needed. strpool_length is a very fast
function to call - it does little more than an array lookup. If handle is invalid, strpool_length returns 0.

Why would the length not stay valid even after a call to strpool_defrag()? The string still exists, it's just that its location in memory may have changed. So is the documentation accurate?

Another nitpick, wouldn't it be better to say that this returns the length in bytes, not characters? I don't think strpool is doing any kind of UTF8 decoding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions