4 ms·
I don't think I can agree more with your comment. C++ in fact is only usable (in a team) if its features are pruned and limited in a team. Really Throw in som
by raverbashing 12y ago
I don't think I can agree more with your comment.
C++ in fact is only usable (in a team) if its features are pruned and limited in a team. Really
Throw in some fine preprocessor magic and you'll end up with completely unmaintanable and impossible to understand code.
- mtdewcmu 12y agoYeah. C is a boring language that barely ever changes. But I'm not sure there isn't wisdom in being dull.
- nitrogen 12y agoCompound literals in C are awesome like it's 1999: Assuming you have this: struct point { float x, y, z; }; void do_something_with_point(struct point *p); You can do this: do_something_with_point(&(struct point){.x = 1.5, .y = 1.5, .z = 3.5});
- mtdewcmu 12y agoYou can take the address of a literal? Being able to specify a literal for a struct is useful. You can, for instance, put the literal in a macro and use the macro to initialize or reset a struct. It's better than having to write additional functions to do something trivial.
- nitrogen 12y agoYes, you can. You can use it to create an approximation of named parameters, because struct members that don't have an initializer will default to zero. It's still not nearly as compact as, say, Ruby, but for C it's pretty awesome and fast.