Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable passing of named structs in functions #17

Closed
wants to merge 1 commit into from

Conversation

halfaleague
Copy link

I wanted to pass around a list of vecs but gcc complains about anonymous structs.
Here is my solution, any thoughts?

Use kvec_init_t(type_name) to create a named struct.
Use kvec_type_t(type_name) as the type.

Example:

// make type
kvec_init_t(int, ints_vec)

int add_ints(kvec_type_t(ints_vec) *my_ints, int uport) {
// function body
}

@arrbee
Copy link
Contributor

arrbee commented May 29, 2013

Can you not just

typedef kvec_t(int) kvec_ints_t;

int add_ints(kvec_ints_t *my_int_vecs, ...) {
   ...
}

@halfaleague
Copy link
Author

Yes, thanks ...

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.

None yet

2 participants