http://stackoverflow.com/questions/330793/how-to-initialize-a-struct-in-accordance-with-c-programming-language-standards 在内核中fs/ext3/indoe.c中,一个struct初始化格式个这样的: static const struct address_space_operations ext3_writeback_aops = { .readpage = ext3_readpage, .readpages = ext3_readpages, .writepage = ext3_writeback_writepage, .write_begin = ext3_write_begin, .write_end = ext3_writeback_write_end, .bmap = ext3_bmap, .invalidatepage = ext3_invalidatepage, .releasepage = ext3_releasepage, .direct_IO = ext3_direct_IO, .migratepage = buffer_migrate_page, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; 我以前没见过这种形式,于是查了一下,原来这是属于C99的“新”特性。 初始化 对于最初(C89)一般形式的struct初始化,需要在大括号中按照成员顺序初始化,和初始化数组很类似;而C99支持乱序初始化,只要给出初始化的变量名,并且在前面加点,后边加等号即可。下面举例和c语言中一般形式的初始化结构体对比: