
15 Dec
2007
15 Dec
'07
3:26 p.m.
bulat.ziganshin:
Hello Don,
Saturday, December 15, 2007, 10:57:02 PM, you wrote:
Do you have the single loop C program, btw? I'd be curious to see if this is really "feasible". It would have to do the buffering, tokenising and accumulating in one go. I'd imagine it is a bit hairy.
for (int n; n = read (0, buf, 32768);) { for (char *p=buf,*end=buf+n;;) while (*p++==' ') if(p==end) goto end; while (*p++!=' ') if(p==end) goto end; words++; } end:; }
How many loops is that, Bulat? :) -- Don