Skip to content

String functions, passing structure instead of pointer ? #2411

Closed Answered by cpq
dev31337 asked this question in Ask questions, get answers
Discussion options

You must be logged in to vote

@dev31337 the reason is to have an ability to craft arguments on the fly. Consider

foo(mg_str("hello"));

vs

struct mg_str arg = mg_str("hello");
foo(&arg);

As you've pointed out, the struct is tiny so passing a struct is not an issue.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by scaprile
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants