-
Notifications
You must be signed in to change notification settings - Fork 313
Open
Description
缺乏类型检查,什么都可以往里塞。
编译不报错,连warning也不报。
运行时报错
vector_t *pvec_strptr = create_vector(string_t);
vector_init(pvec_strptr);
string_t *pstr1 = create_string();
string_init(pstr1);
string_assign_cstr(pstr1, "abc");
vector_push_back(pvec_strptr, pstr1);
vector_push_back(pvec_strptr, "123");
vector_push_back(pvec_strptr, 123);
vector_push_back(pvec_strptr, NULL);
string_t *pstr2 = (string_t *)vector_at(pvec_strptr, 0);
printf("%s ", string_c_str(pstr2));
vector_destroy(pvec_strptr);
Metadata
Metadata
Assignees
Labels
No labels