可变参数函数的起源是什么?

发布于 2024-12-14 11:50:15 字数 121 浏览 1 评论 0原文

可变参数函数是否源自特定语言、数学、科学文章......?有什么想法吗?

Did Variadic functions originate from a specific language, from math, from an scientific article...? Any idea?

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

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

发布评论

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

评论(3

北方。的韩爷 2024-12-21 11:50:15

有许多数学和逻辑运算自然地表现为可变参数函数。例如,数字求和或字符串或其他序列的串联是逻辑上可以应用于任意数量的操作数的操作。

尽管标签可变参数函数听起来很现代,但概念它可能和车轮一样古老。好吧,也许没有那么多,但它的演变是如此合乎逻辑,以至于它可能在此过程中被多次重新发现。

Watcom 编译器可能是第一个 实现 C 语言:

可变参数函数回退到基于 Watcom 堆栈的调用约定。

Watcom C/C++ 编译器是计算机编程语言 C 和 C++ 的编译器,可为多个平台和操作系统生成可执行程序。它为 MS-DOS 生成的代码执行速度非常快。它是最早支持 Intel 80386“保护模式”的编译器之一。在 20 世纪 90 年代中期,一些技术上最雄心勃勃的 DOS 游戏,例如《毁灭战士》、《血统》和《毁灭公爵 3D》都是使用 Watcom C 构建的。 Sybase 不再进行商业销售,Watcom C/C++ 编译器和 Watcom Fortran 编译器已作为 在 SciTech Software 的帮助下免费开源 Open Watcom 软件包

也就是说,我认为这个问题更适合 math.stackexchange.com

There are many mathematical and logical operations that come across naturally as variadic functions. For instance, the summing of numbers or the concatenation of strings or other sequences are operations that can logically apply to any number of operands.

Even though the label variadic functions sounds modern, the concept of what it is may be as old as the wheel. Ok, maybe not that much, but its such a logical evolution that it was probably re-discovered multiple times along the way.

The Watcom compiler may have been the first to have implemented it for the C language:

Variadic functions fall back to the Watcom stack based calling convention.

The Watcom C/C++ compiler is a compiler for the computer programming languages C and C++ that produces executable programs for several platforms and operating systems. The code it produces for MS-DOS executes very fast. It was one of the first compilers to support the Intel 80386 "protected mode". In the mid-1990s some of the most technically ambitious DOS games such as Doom, Descent and Duke Nukem 3D were built using Watcom C. Though no longer sold commercially by Sybase, the Watcom C/C++ compiler and the Watcom Fortran compiler have been made available as the free and open source Open Watcom package with the assistance of SciTech Software

That said, I think this question is better suited to math.stackexchange.com.

随遇而安 2024-12-21 11:50:15

他们想要 printf() 和 scanf()。

They wanted printf() and scanf().

南薇 2024-12-21 11:50:15

BCPL、Algol 68 以及 Fortran 和 COBOL(从某个角度来看)具有可变参数函数:

http://en .wikipedia.org/wiki/Printf_format_string

可变参数作为“可变数量的参数”是一个数学概念,无论如何,它要古老得多。

BCPL, Algol 68 and Fortran and COBOL (from a certain point of view) have variadic functions:

http://en.wikipedia.org/wiki/Printf_format_string

Variadic as "variable number of arguments" is a mathematical concept, much older, anyway.

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