We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
your example with run_server( "3490" ); doesn't work if the struct has default arguments
run_server( "3490" );
#include <stdio.h> struct run_server_options { char * port; int backlog; }; #define run_server( ... ) \ run_server_( ( struct run_server_options ){ \ /* default values */ \ .port = "45680", \ .backlog = 5, \ __VA_ARGS__ \ } ) int run_server_( struct run_server_options opts ) { printf("port: %s backlog: %d\n", opts.port, opts.backlog); } int main( void ) { return run_server( "3490" ); }
this code adds too many elements to the struct "3490" is totally ignored and the output is port: 45680 backlog: 5
"3490"
port: 45680 backlog: 5
The text was updated successfully, but these errors were encountered:
No branches or pull requests
your example with
run_server( "3490" );
doesn't work if the struct has default argumentsthis code adds too many elements to the struct
"3490"
is totally ignored and the output isport: 45680 backlog: 5
The text was updated successfully, but these errors were encountered: