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

Question, why in sds.h you have (static inline functions)? #85

Open
topilski opened this issue Sep 5, 2017 · 2 comments
Open

Question, why in sds.h you have (static inline functions)? #85

topilski opened this issue Sep 5, 2017 · 2 comments

Comments

@topilski
Copy link

topilski commented Sep 5, 2017

Hi, why in sds.h you have (static inline functions)? Also why sdshdr* placed in header? I try to link sds.h into C++ project with -Wpedantic flag and receive errors like "warning: ISO C++ forbids zero-size array in sdshdr* structs".

@Kredns
Copy link

Kredns commented Sep 7, 2017

@topilski The most likely reason the functions are made static inline is for performance reasons. See this answer on StackOverflow for more specifics..

Why are you trying to use this library in a C++ project when C++ already has std::string which does a pretty good job at providing strings.

@topilski
Copy link
Author

topilski commented Sep 7, 2017

I using sds for parsing command line, i like how it done in sds. About inline functions (compiler to attempt to embed the function), inline only suggestion for compiler, need to disassemble code and after that talk about applying of inlining.

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

No branches or pull requests

2 participants