What's an “auto-casting bool”?

核能气质少年 提交于 2019-12-11 22:09:04

问题


On the following answer to a previous question someone mentioned an "auto-casting bool"

I guess null has an auto-casting bool that is false. What is it, and what does the code that makes it look like?


回答1:


The phrase "auto-casting bool" is a poor phrase someone used off hand. I believe what they mean is the internal ToBoolean operation

Of special note is the if statement which calls ToBoolean on the expression.

I don't know my way around the v8 source code but here is a search for ToBoolean on the v8 repo.

For reference v8 is the javascript implementation used by chrome and written in C++



来源:https://stackoverflow.com/questions/7634584/whats-an-auto-casting-bool

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