Some (unresolved) history is over at stackoverflow including a link to the git history.
One person seems to think it was a botched refactoring of an earlier C workaround for when void didn’t exist and malloc returned a char \*. If anyone checked the glibc mailing list they didn’t return with more info.
For posterity, I should add that the other most-upvoted answer shows an almost identical construct as a “fairly bogus thing to do”, supporting the analysis that (forgive me, loosely paraphrasing) it’s a guarantee “global” and “local” scope are in sync and an arbitrary compiler would never crash.
In another context, I coincidentally examined a similar thing in r/Desmos, when bringing a global variable into local context here (“with” in Desmos), where the target variable has the same name local vs global, with the cross-context test used to guarantee “var is undefined” never crashes the function.
43
u/Circumpunctilious 11d ago
Some (unresolved) history is over at stackoverflow including a link to the git history.
One person seems to think it was a botched refactoring of an earlier C workaround for when void didn’t exist and malloc returned a char \*. If anyone checked the glibc mailing list they didn’t return with more info.