나는 fallowing 구조체가 :구조체 내의 통합. 컴파일 경고. C
struct lshort_sched_param {
int requested_time;
int level;
};
struct sched_param {
union {
int sched_priority;
struct lshort_sched_param lshort_params;
};
};
을 그리고 난 그렇게처럼의 새 인스턴스를 만들려고 해요 : 일부 경고
struct lshort_sched_param *l = {2 ,1};
struct sched_param *p = {3, l};
를 얻을 :
test.c:5: warning: initialization makes pointer from integer without a cast
test.c:5: warning: excess elements in scalar initializer
test.c:5: warning: (near initialization for `l')
test.c:6: warning: initialization makes pointer from integer without a cast
test.c:6: warning: excess elements in scalar initializer
test.c:6: warning: (near initialization for `p')
을 아무도 내게 그것을 도울 수 있습니까?
코드에 여러 가지 문제가 있습니다. 왜 포인터를 선언하고 마치'struct'처럼 초기화합니까? – fuz
* anonymous * union을 선언했음을 주목하십시오. 식별자를 선언하면 어떨까요? 'union {...} foo;와 같이. – Jens