Skip to content

p_context pointers are declared as const pointers #93

@hwmaier

Description

@hwmaier

What is the rationale to use a const pointer rather a normal void pointer for p_context fields?

According to the documentation this pointer is intended to hold user data and make it available to callback functions. Declaring this pointer as const means that the user data it holds cannot be modified from within the callback function.

This limits its use and while in C the const can be easily cast away using a type cast, in C++ this requires unnecessary const_casts to remove the constness.

I suggest to change p_context to a simple void * pointer so it can hold both const and non-const user data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions