Stigmatism for emptiness? or what? and why?

I was looking for the llvm clang implementation of the C ++ standard library ...
In the file mutex.cpp

I found the following code:

void
mutex::unlock() _NOEXCEPT
{
    int ec = pthread_mutex_unlock(&__m_);
    (void)ec;                              // What??, Why??? O.o
    assert(ec == 0);
}

      

I don't understand what this expression does and why ... I need an explanation.

+3


source to share


1 answer


I think this expression is used to avoid a compiler warning that a variable has been declared but not used.



As user2864740 pointed out, the assert statement in this code could be mcaro, which in some conditions does not use the variable. That is, it can be expanded to an empty statement.

+4


source







All Articles