On Mon, Aug 03, 2015 at 03:32:30PM +0100, Rainer Weikusat wrote: > Hendrik Boom <[email protected]> writes: > > On Mon, Aug 03, 2015 at 01:14:16PM +0100, Rainer Weikusat wrote: > > > >> > >> [*] In case you want an example where this is at least debatable (and I > >> happen to disgree with what he wrote on the topic). The simplest way > >> to implement a block memory copy in C is > > > > Correction: > > > >> > >> static void cpy(char *d, char const *s, size_t len) > >> { > >> while (len) --len, d[len] = s[len]; > > while (len){ --len, d[len] = s[len]; | > >> } > >> > > > > It may have been simple, but not correct. > > A C 'while loop' is defined as > > while ( expression ) statement > > and > > --len, d[len] = s[len]; > > is a perfectly valid expression statement.
Interesting! You are right! I misread a comma as a semicolon. I never thought of using commas this way. Now I get to wonder whether this way of eliminating brackets is clarifying or misleading. It misled me. But As a old user of the Lisp family of languages, I hate explicit brackets. -- hendrik > _______________________________________________ > Dng mailing list > [email protected] > https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng _______________________________________________ Dng mailing list [email protected] https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
