Modern Electronics (was Re: List charter mods & headcount... ;

From: der Mouse <mouse_at_Rodents.Montreal.QC.CA>
Date: Wed Jun 23 22:31:09 2004

> The code would be better written as:
[compressed again -dM]
> #include <limits.h>
> void foo(char *s)
> { size_t charcount[-CHAR_MIN + CHAR_MAX];
> memset(charcount,0,sizeof(charcount));
> for ( ; *s ; s++) charcount[*s + -CHAR_MIN]++; }

Okay, class, now who can find the bug in _this_ version? (Yes, there
is one.)

/~\ The ASCII der Mouse
\ / Ribbon Campaign onetime comp.lang.c maven
 X Against HTML mouse_at_rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Received on Wed Jun 23 2004 - 22:31:09 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:37:00 BST