General Category > Ideas
Make increment operators statements, not expressions
bas:
Well one of the starting reasons I started with C2 was the realization that:
* I was still programming C after 10 years
* There were many new language, but none that's in the domain of C
* I would probably be programming C for 10 more yearsNow I like C, but some of it's quicks do feel a bit 20th century.
I don't mind making the language a bit more restricting, as it actually speeds up
development (by reducing debug time). As a rule of thumb, if the C compiler would
let you do something that all C programmers consider bad form, the C2 compiler
would just give an error.
There are a lot more ideas that can go into the language, but the idea is also not
to step outside the C domain (eg threading, garbage-collection, etc).
kyle:
A note about this: C's macros make this problem much worse. It is very easy to not realize that something in a macro is used twice and do this:
foo = MY_MACRO(b[i++]);
But the macro is defined:
#define MY_MACRO(a) (a + a)
Ooops.
With the macros concept I read here (yay!), this is a lot less risky. I personally like the idea of making it a statement to simply eliminate the practice, but it is one of the parts of the "C scripture" that might be a harder sell as Bas mentioned. Maybe a warning is best.
Best,
Kyle
Navigation
[0] Message Index
[*] Previous page
Go to full version