int load(const char *path) { FILE *f = fopen(path, "r"); if (!f) return -1; defer fclose(f); char *buf = malloc(4096); if (!buf) return -1; defer free(buf); /* 业务逻辑 */ return 0; } 用 C6 给 C 语言装上 defer、try/catch、async..
15 分钟让你有 C 语言超能力!!!
int load(const char *path) { FILE *f = fopen(path, "r"); if (!f) return -1; defer fclose(...
来源:OSChina开源
阅读原文