Chris Rowland said:
John Beetem said: But the real power of C comes from idioms like:
while (*s++ = *t++) /*nop*/;
I'd forgotten about pointers in C
I would avoid that sort of pattern in real world applications because it's barely maintainable. It assumes a really experienced C developer, I'm not sure I know when it stops.
As a long-time C programmer, it's obvious to me that it's a copy of some sort, but without knowing the size of *s & *t it could be copying anything. It stops when the expression evaluates to zero which is when the last item copied is zero.
The issue I have with that is that s and t read (to me) as 'source' and 'to', so it's the wrong way round, but I suspect John wasn't really thinking of that when he typed it in as an example!
I'd only use that in a really time critical place where it's worth the extra time it will take to get it just right.
I'd probably use strcpy() if it's a string being copied - e.g. it might be quicker to copy words at a time, then do the initial & last 1,2 or 3 bytes via character pointers - using the system functions hopefully helps make use of architechure specific stuff like that which you often don't really care about!
My first language was Algol and even as a first language I found it's verbose nature to be a nuisance. My second was FORTRAN and it was a great day when I got my hands on ratfor and could use curly brackets and abandon line numbers and GOTO!
Oddly enough I looked at Algol (briefly) after BASIC, and another Algol derived language called IMP... But after being force-fed Pascal (& FORTRAN & COBOL) and then finding out about C, I sort of didn't look back and abandoned everything after that
Actually not quite as I didn't have the means to write the stuff I was working on at the time (30 years ago) in C, but I did do a huge amount in BCPL on the BBC Micro...
What seems to be coming out from this is that the important thing for education is not so much the language as the development environment.
It needs to be quick to write simple code fragments and get instant feedback - the WOW factor.
It needs good feedback when there are errors.
It needs good, easily available, descriptions of the language, expressed in ways that make sense to the beginner.
It needs to be easy to save and load programs so they can be kept and extended easily.
Stepping, breakpoints and examining variables are very useful, especially as things get bigger.
So you've just described BASIC
The big difference I see with real world development is that applications tend to be much bigger, have more interlocking parts and have a longer lifetime - thus requiring maintenance.
An IDE I find really nice, but lightweight is for the PICAXE. It's a free download and has a simulator so people can try it without having to buy the chips.
I'm not trying to push a rival here, I think there's virtually no overlap.
Intersting. Looks like it's a glorified macro assembler with BASIC-like instructions..