使用 print 语句来调试代码怎么称呼?

发布于 2024-08-24 13:54:51 字数 286 浏览 2 评论 0原文

我只是好奇,但是使用 print 语句调试代码的过程有名称吗? 中的一个例子

 x=3.2e39
 print x
 y = function1(x)
 print y
 z = function2(y)
 print z
 w = function3(z)
 print w

伪代码执行

 3.2e39
 3.2e36
 NaN
 NaN

:揭示了 function2 中一些糟糕的数学。如果没有标准名称,你怎么称呼它?

I'm just curious, but is there a name for the process using print statements to debug your code? An example in pseudocode

 x=3.2e39
 print x
 y = function1(x)
 print y
 z = function2(y)
 print z
 w = function3(z)
 print w

Executation:

 3.2e39
 3.2e36
 NaN
 NaN

reveals some bad math in function2. If there's no standard name, what do you call it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沧桑㈠ 2024-08-31 13:54:51

它通常被称为“printf 调试”,即使在 C 函数之后没有使用名为 printf 的东西。这实际上是一种简单的日志记录形式,您可以使用各种名称来实现这种效果。

在具有上面所示的 print 语句或函数的语言中,“打印调试”就足够清楚了,而无需向从未使用过 C 或类似函数的人解释 printf。

It is often called "printf debugging", even if something named printf isn't used, after the C function. It's really a simple form of logging, and you could use various names to that affect.

In a language that has a print statement or function as you showed above, "print debugging" would be clear enough without having to explain printf to someone that's never used C or a similar function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文