On 06/18/12 10:57, Dave Hart wrote: So curiosity got the better of me. Here is code from glibc:
> /* Find the first occurrence of C in S. */ > char * > strchr (s, c_in) > const char *s; > int c_in; > { > const unsigned char *char_ptr; > const unsigned long int *longword_ptr; > unsigned long int longword, magic_bits, charmask; > unsigned reg_char c; > > c = (unsigned char) c_in; > > /* Handle the first few characters by reading one character at a time. > Do this until CHAR_PTR is aligned on a longword boundary. */ > for (char_ptr = (const unsigned char *) s; > ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0; > ++char_ptr) > if (*char_ptr == c) > return (void *) char_ptr; Please notice the last line. The cast is being used to strip the const-ness from "char_ptr". This is not really different from stripping it from the argument. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Autogen-users mailing list Autogen-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/autogen-users