Re: About += and ++
"Stephen Sprunk" <stephen@sprunk .orgwrote in message
That terse strcpy() seems to have driven a lot of C grammar.
However generally you write strcpy() once, if embedded, or never, on a
hosted implementation.
--
Free games and programming goodies.
"Stephen Sprunk" <stephen@sprunk .orgwrote in message
Another major part of it is laziness. "++i" obviously takes less typing
than "i=i+1", and takes less space to store in source form as well. When
you get to more complicated idioms, like "while (*i++ = *j++);" vs "do {
*i=*j; i=i+1; j=j+1; } while (*j);", the space savings gets significant,
as does readability. Such things appear over and over in most programs,
so it's normal that a language that "evolved" (as opposed to one that was
"designed") would incorporate features to make the programmer's life
easier for common tasks.
>
than "i=i+1", and takes less space to store in source form as well. When
you get to more complicated idioms, like "while (*i++ = *j++);" vs "do {
*i=*j; i=i+1; j=j+1; } while (*j);", the space savings gets significant,
as does readability. Such things appear over and over in most programs,
so it's normal that a language that "evolved" (as opposed to one that was
"designed") would incorporate features to make the programmer's life
easier for common tasks.
>
However generally you write strcpy() once, if embedded, or never, on a
hosted implementation.
--
Free games and programming goodies.
Comment