简体   繁体   English

有没有不支持ANSI C 89的平台?

[英]Is there any platform that not supports ANSI C 89?

It seems ANSI C 89 is the best choise for writing a cross-platform library because many platforms (Windows, Unix, Linux, Mac, Android, ...) supports it. 看起来ANSI C 89是编写跨平台库的最佳选择,因为许多平台(Windows,Unix,Linux,Mac,Android等)都支持它。

But is there any platform that not supports ANSI C 89? 但是有没有不支持ANSI C 89的平台?

I am not sure about J2ME, iPhone and so on.. 我不确定J2ME,iPhone等等。

First, ANSI C usually refers to C89, so the C89 is redundant. 首先,ANSI C通常是指C89,因此C89是冗余的。

iOS supports ANSI C, as well as most of the platforms. iOS支持ANSI C以及大多数平台。 J2ME is a Java platform and by default it does not support C at all. J2ME是一个Java平台,默认情况下它根本不支持C.

The main platforms all support ANSI C, but there are some embedded platforms that does not. 主要平台都支持ANSI C,但有一些嵌入式平台没有。 I don't think you should be worried about any of those. 我认为你不应该担心这些问题。

Any platform that has too little memory either for code or for data does not support C. As mandated by the standard in section "2.2.4.1 Translation limits": 任何代码或数据内存太少的平台都不支持C.根据“2.2.4.1翻译限制”一节中的标准规定:

The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits: 该实现应能够翻译和执行至少一个包含以下每个限制的至少一个实例的程序:

  • 15 nesting levels of compound statements, iteration control 15个复合语句的嵌套级别,迭代控制
    structures, and selection control structures 结构和选择控制结构

  • 8 nesting levels of conditional inclusion 8个嵌套级别的条件包含

  • 12 pointer, array, and function declarators (in any combinations) 12个指针,数组和函数声明符(以任意组合)
    modifying an arithmetic, a structure, a union, or an incomplete type 修改算术,结构,联合或不完整类型
    in a declaration 在声明中

  • 31 declarators nested by parentheses within a full declarator 31个声明符由完整声明符中的括号嵌套

  • 32 expressions nested by parentheses within a full expression 32个表达式由完整表达式中的括号嵌套

... ...

  • 127 identifiers with block scope declared in one block 在一个块中声明了块标识符的127个标识符

... ...

  • 31 parameters in one function definition 一个函数定义中的31个参数

  • 31 arguments in one function call 一个函数调用中有31个参数

... ...

  • 509 characters in a character string literal or wide string literal (after concatenation) 字符串文字或宽字符串文字中的509个字符(连接后)

  • 32767 bytes in an object (in a hosted environment only) 对象中的32767个字节(仅限托管环境中)

... ...

  • 127 members in a single structure or union 单个结构或联盟中的127个成员

... ...

  • 15 levels of nested structure or union definitions in a single 单个中有15个级别的嵌套结构或联合定义
    struct-declaration-list 结构声明列表

You will likely find other requirements if you read the standard with attention. 如果您仔细阅读标准,您可能会找到其他要求。

In the end, if there's enough memory, even an otherwise weak platform can support C. It will have to have extra code to overcome the hardware limitations (eg support the required types, arithmetic operations and so on). 最后,如果有足够的内存,即使是一个弱的平台也可以支持C.它必须有额外的代码来克服硬件限制(例如支持所需的类型,算术运算等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM