linux 社区找的一段代码,这样的C代码看起来简洁多了
struct file_operations
{
int (*seek) (struct inode * ,struct file *, off_t ,int);
int (*read) (struct inode * ,struct file *, char ,int);
int (*write) (struct inode * ,struct file *, off_t ,int);
int (*readdir) (struct inode * ,struct file *, struct dirent * ,int);
int (*select) (struct inode * ,struct file *, int ,select_table *);
int (*ioctl) (struct inode * ,struct file *, unsined int ,unsigned long);
int (*mmap) (struct inode * ,struct file *, struct vm_area_struct *);
int (*open) (struct inode * ,struct file *);
int (*release) (struct inode * ,struct file *);
int (*fsync) (struct inode * ,struct file *);
int (*fasync) (struct inode * ,struct file *,int);
int (*check_media_change) (struct inode * ,struct file *);
int (*revalidate) (dev_t dev);
} |
在变量前面加变量的数据类型这种方法现在是被抛弃的方法,有很多弊端,可以看下华为的C规范以及大公司的C规范; 另外c语言我我认为最好的风格还是unix 或者是linux风格,搞大小写混杂的驼峰写法非常不好 下划线和小写简洁明了