在我的程序中,调用pthread_create看起来像:
res = pthread_create(&a_thread, NULL, thread_fn, (void*)n);
Run Code Online (Sandbox Code Playgroud)
我的问题是,为什么我们不能这样做:
res = pthread_create(&a_thread, NULL, thread_fn( (void*)n) );
Run Code Online (Sandbox Code Playgroud)
因为这将减少参数的数量,pthread_create并且看起来也是合乎逻辑的,因为我只学习了3件事:声明,定义和调用.
将函数名称作为参数传递并添加到将其参数作为单独参数传递的内容是我不明白的事情.
如果这种格式背后有任何逻辑,请善解释.
c ×1