3 ms·
That probably shows (once more) that the C language really needs an overhaul, with a stricter grammar disallowing that sort of tricks. Or maybe not.
by waltpad 6y ago
That probably shows (once more) that the C language really needs an overhaul, with a stricter grammar disallowing that sort of tricks.
Or maybe not.
- platinumrad 6y agoThis is a valid Rust program: fn main() { return return return return return return return } You can do silly things in any language.
- waltpad 6y agoIndeed, anyone can also write code over-abusing lambdas in a functional language, but lambdas are also quite useful in the majority of cases. On the other hand, can you point out a single situation where swapping int and typedef in a type definition brings anything good? Likewise, in your example, I doubt that this could bring anything. Is there a practical obfuscation method based on that quirk in Rust, or a reason for keeping it in the syntax? I cannot tell, but maybe you can? Overall, the problem that I have with this is not that it is silly, it is that it makes it harder to understand and maintain. In some cases, it requires active engineering to fix the issue, but the language should be designed so that most of these problems are taken care of by design. Also, many people seem to enjoy the fact the C can be bent that way. I don't mean to remove that from them, I just think that for system programming, it should be less permissive. Perhaps a 'strict mode' could be devised, not at the syntax level like in javascript (which I suppose couldn't be avoided), but as compiler flag (like the c++ people did it).
- kccqzy 6y agoOne guy's useless tricks can be another's essential flexibility. Especially when you consider code generation.
- waltpad 6y ago> Especially when you consider code generation. That's a very good point you are making here. However, as I said elsewhere, I don't see the use of being able to either write typedef int ... or int typedef ... and I don't think that proper code generation would require it.
- anthk 6y agoAny language can do that. Forth can be a nightmare. Or Perl. Or your beloved Rust. You hipsters must stop talking bullshit and getting your facts better, because you keep parroting the same stuff without understanding that you have the same exact issues on modern languages. Don't even let me start on Java on that issues, because I've seen ridiculous structures all over the code.
- waltpad 6y agoI don't know Forth, Perl, or even Rust enough to discuss them on that basis, but having other languages allowing it doesn't mean that C should be lenient about it either, or does it? Now, don't get me wrong, I do not dislike C, I've practiced it a lot, and I come back to it from time to time when I need to. But I would rather use a language where many of these forms are forbidden for readability and maintainability.