[질문] 구조체 초기화 불완전?
글쓴이: zipsinworm / 작성시간: 목, 2007/07/26 - 11:41오전
안녕하세요. 이번에는 구조체 초기화에 질문이 있어서 글 올립니다.
우선 간단한 소스를 보면,
- test.h -
typedef struct info{
unsigned short length;
unsigned short num;
}datainfo;
typedef struct convert{
unsigned short maker[3];
datainfo data[2];
}converttbl;
extern const converttbl table[];
- test.c -
#include "test.h"
const converttbl table[]=
{
{0x2001,0x0001,0x0000,0,0,0,0},
{0x3003,0x0001,0x0001,0,0,0,0}
};
int main(void)
{
return 0;
}
확인차 간단한 소스를 만들어 컴파일 해보니(-Wall 옵션포함).
"table[0].maker의 초기화가 불완전 합니다."라는 경고가 나옵니다.
왜 초기화가 불완전한건지, 어디가 잘 못된것일까 생각을 해봐도 답이 안나오네요.
요즘은 에러가 나오는것보다 경고가 더 무섭다는..ㄷㄷㄷ
Forums:


이렇게 하면 없어지네요. ^^;;
const converttbl table[]= { {{0x2001,0x0001,0x0000},{{0,0},{0,0}}}, {{0x3003,0x0001,0x0001},{{0,0},{0,0}}} };{ [0] = {
{ [0] = { .maker = { [0] = 0x2001, [1] = 0x0001, [2] = 0x0000 }, .data = { [0] = { .length = 0, .num = 0 }, [1] = { .length = 0, .num = 0 } } }, [1] = { .maker = { [0] = 0x3003, [1] = 0x0001, [2] = 0x0001 }, .data = { [0] = { .length = 0, .num = 0 }, [1] = { .length = 0, .num = 0 } } } };OTL
댓글 달기