TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What should an undefined variable evaluate to?

1 点作者 carlosneves8 个月前
I think most (all?) compiled languages evaluate to a compilation error.<p>As for NodeJS, I thought it would evaluate to `undefined`, but it seems to consistently throw a `ReferenceError` for version 20.<p>What&#x27;s the result for other languages?

1 comment

Doctor-R8 个月前
Ages ago, the Digital Equipment VAX had a hardware hack where a null pointer (value is 0) would return a 0 when de-referenced. Which is the null character, the end of a string. So most of the time operations moving characters would terminate correctly. Obviously not portable to other computers.<p>In the IEEE 754 floating point definition, there are specific values for errors: mathematically undefined, division by zero, overflow, underflow, and inexact. These MUST be implemented in hardware to meet the specification.
评论 #41621362 未加载