x86 및 x86_64 시스템에서 int16_t
을 컴파일하는 동안 int16_t complex
이 컴파일되지 않는 이유는 short int
에 typedef가 있습니까? 다음은 g99 5.4 및 4.9에서 C99 및 C11 표준을 사용하여 테스트 한 샘플 코드입니다. 컴파일러는 선언 지정자에 두 개 이상의 데이터 유형이있는 것에 대해 불만을 토로합니다.왜 'int16_t complex'가 작동하지 않습니까?
코드 :는
#include <complex.h>
#include <stdint.h>
#include <stdio.h>
int main()
{
float complex x = I + I/3 * I/2;
short int complex y = I + I/3 * I/2;
int16_t complex z = I + I/3 * I/2; /* Why ? */
printf("x=(%+f,%+f)\n", creal(x), cimag(x));
printf("y=(%+f,%+f)\n", creal(y), cimag(y));
printf("z=(%+f,%+f)\n", creal(z), cimag(z)); /* Why ? */
return 0;
}
오류 :
In file included from ./complex.c:1:0:
./complex.c: In function ‘main’:
./complex.c:9:13: error: two or more data types in declaration specifiers
int16_t complex z = I + I/3 * I/2; /* Why ? */
는 는
컴파일러 명령 줄
:는
gcc-5 --std=c99 ./complex.c -o ./complex
gcc-4.9 --std=c99 ./complex.c -o ./complex
C99 모드 ('-std = c99')로 실행할 때'short int complex'가 허용됩니까? 경고 수준을 높이는 것을 고려하십시오. – alk
@alk 예. '--pedantic'과'-Wall -Werror'도 있습니다. –