【发布时间】:2020-10-19 20:17:44
【问题描述】:
我正在尝试在旧的 HP 3000 MPE/iX 计算机系统上调试编译器错误。错误是:
cc: "func.c", line 8: error 1705: Function prototypes are an ANSI feature.
cc: "func.c", line 15: error 1705: Function prototypes are an ANSI feature.
代码如下。衷心感谢您的帮助:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define MAX_LEN 80
int find_length( char *string )
{
int i;
for (i =0; string[i] != '\0'; i++);
return i;
}
int main( void )
{
char string[132];
int result;
int again = 1;
char answer;
printf( "This program finds the length of any word you ");
printf( "enter.\n" );
do
{
printf( "Enter the word: ");
fflush(stdin);
gets( string );
result = find_length( string );
printf( "This word contains %d characters. \n", result);
printf("Again? ");
scanf("%c", &answer);
} while (answer == 'Y' || answer == 'y');
}
【问题讨论】:
-
试试
int find_length() char *string; { ... }。听起来那是一个 K&R pre-ANSI 编译器。 -
Re "听起来那是一个 pre-ANSI K&R 编译器。", *Jaw drops* 我知道今年很多人都想忘记,但这很愚蠢!
-
@ikegami 该硬件始于 70 年代。可能是“如果它没有损坏 ...”的极端情况;-)
-
@dxiv,我知道,我知道。我为控制当地核电站的计算机做了一些开发。它是 1972 年的 Varian72。它有 32 KiW 的 RAM(64 KiB,每个 16 位字都有一个地址)。
-
看起来它认为那些函数声明实际上是函数原型?尝试将
void参数取出到main并将main移动到此文件中的第一个函数。
标签: c compiler-errors kernighan-and-ritchie function-prototypes ansi-c