Skip to content

docs: document differences between config_lookup and typed lookups (#242) - #297

Merged
hyperrealm merged 1 commit into
hyperrealm:masterfrom
maruixin-kls:docs/typed-vs-path-lookup-242
Sep 9, 2026
Merged

docs: document differences between config_lookup and typed lookups (#242)#297
hyperrealm merged 1 commit into
hyperrealm:masterfrom
maruixin-kls:docs/typed-vs-path-lookup-242

Conversation

@maruixin-kls

Copy link
Copy Markdown

Summary

This PR updates the documentation to clarify the distinction and historical context between path-based lookups (config_lookup) and typed lookups (config_lookup_int, etc.), as requested in issue #242.

Changes Made

  • Added a section in libconfig.texi explaining that config_lookup returns a pointer to the setting structure, allowing for further traversal or type checking.
  • Clarified that typed lookup functions (e.g., config_lookup_int) are convenience wrappers that combine path resolution and type conversion into a single step.
  • Highlighted the difference in return values (pointer vs. boolean status) which is a common point of confusion for users migrating from older patterns.

Why this is important

Users often confuse when to use the generic lookup versus the typed lookup. Documenting this "historical" design choice helps clarify that typed lookups are essentially syntactic sugar for config_lookup followed by setting_get_*, while the generic lookup offers more flexibility for complex structures.

Fixes #242

@hyperrealm

Copy link
Copy Markdown
Owner

Thanks for adding this!

@hyperrealm
hyperrealm merged commit 22e16c1 into hyperrealm:master Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behavior of config_setting_lookup_* is inconsistent with config_setting_lookup

2 participants