Comment by 1718627440
2 hours ago
Your first example doesn't make sense, because
struct S { int a; };
is also fine and idiomatic in C. It is rather
typedef struct S { int a; } S;
that doesn't make sense, because why would you make something opaque and expose it immediately again in the same line?
The others are ... different. I can't tell whether they are really better. The second maybe, although I like it that the compiler forces me to forward type stuff, it makes the code much more readable. But then again I don't really get the benefit of
import foo;
vs
#include <foo>.
include vs import is no difference. # vs nothing makes it clear that it is a separate feature instead of just a language keyword. < vs " make it clear whether you use your own stuff or stuff from the system. What do you do when your file contains spaces? Does import foo bar; work for including a file a single file, named "foo bar"?
No comments yet
Contribute on Hacker News ↗