本文介绍了ansi C 是否限制了程序中外部变量的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

外部变量是指用 extern 修饰符声明的变量(并在程序的其他地方定义).

By external variable I mean a variable declared with the extern modifier (and defined elsewhere in the program).

我被告知此限制,但在网络上找不到确认或反驳.这是真的?如果是,限制是什么?它通常由编译器强制执行吗?

I've been told of this limitation, and couldn't find a confirmation or rebuttal on the web. Is this true? If so, which is the limit? Is it usually enforced by compilers?

推荐答案

是的,每个编译器都应该支持最小限制.

Yes, there is a minimal limit that every compiler should support.

在这种情况下,每个编译器应该能够在一个翻译单元中支持至少 4095 个外部标识符(但大多数编译器可能支持更多).

In this case, every compiler should be able to support at least 4095 external identifiers in one translation unit (but most compilers probably support much more).

这篇关于ansi C 是否限制了程序中外部变量的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 17:48