Skip to content

Is there a reason for dropping type safety in some of the API calls? #815

@gantzm

Description

@gantzm

Is your feature request related to a problem?

In the file af.h, we see the following:

typedef void *ezb_af_ep_desc_t;
typedef void *ezb_af_device_desc_t;

I understand there might be a need to hide internal data structures but this is not a type safe way of doing that. With this type of construct the compiler can't warn us about misused data.

Describe the solution you'd like.

It seems much more safe to write the descriptions as:

typedef struct ezb_af_ep_desc_s {} *ezb_af_ep_desc_t;
typedef struct ezb_af_device_desc_s {} *ezb_af_device_desc_t;

This way if we make a mistake in our code the compiler can at least tell us we've done something wrong.

Describe alternatives you've considered.

I would also consider having the full structure definitions, but that may not be possible.

Additional context.

No response

Edit: Cleaned up a few typos.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions