Understanding C errno

≯℡__Kan透↙ 提交于 2019-12-05 20:31:28

The __error function returns a pointer to the errno variable for the calling thread. The errno macro dereferences that pointer, resulting in an lvalue that can appear on either side of an equals sign.

To answer your questions:

  1. The function determines the correct address for the errno variable for that specific thread. Each thread gets its own.

  2. Yes, it becomes (* __error()) = 0; which assigns 0 to that thread's errno variable.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!