I am trying to compile pthreads for MSVC2015 and found some strange code.
localPtr->wNodePtr->spin := PTW32_TRUE;
What is this line doing?
As others pointed out :=
is not a valid C-operator.
However, this "operator" :=
is found twice in the current "PThread for Windows" source release which seems to be as of v2.9.1.
Both occurencies appear in ptw32_OLL_lock.c
, which proclaims to "implements extended reader/writer queue-based locks", but does not seem to be part of the pthread*.dll
build, so the file ptw32_OLL_lock.c
is not passed to the compiler.
Interesting enough the source file in question contains an int main()
and is not in the test
sub-directory.
All in all this seems to be alpha, beta or it's simply noise, so just delete it.
IIRC, C
standard does not specify anything about :=
operator. So, most likely, it's not standard C
.
However, AFAIK, some languages, which use the =
as comparison operator, to separate the assignment from comparison, use :=
as assignment operator. [Example: Pascal, postgresql]
In some other cases, it carries a meaning that the variable is getting defined and assigned in the same step, to differentiate with normal assignment elsewhere. [Example: GO]
:= is not a valid operator in C.
It does however have use in other languages, for example ALGOL 68. Basically, for what you want to know, the := in this example is used to assign the variable PTW32_TRUE to localPty->wNodeptr->spin
This is done mostly to remove any ambiguity in code, as to avoid using '=' for assignment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With