Why is cap_t
defined as _cap_struct *
? What was the reasoning for obfuscating the pointer type and having libcap functions take/return cap_t
when normal libc usage suggests they would take/return a explicit pointer type?
Obfuscated pointers (actually "opaque") are used to force applications to use the documented functions for a library rather than bypass those functions and manipulate its data directly.
Doing that lets the developers (of the library) concentrate on making the functions work rather than being distracted by handling data inconsistencies.
Further reading: