C, 66 48
Original:
int l(long*s){return strlen(s)/((*s&~(-1L<<56))!=0x656c676f6f67);}
Using OSX gcc,
l("duck");
returns 4
,
l("google");
causes Floating point exception: 8
.
On other platforms, the constants may need to be adjusted for endianness.
Shorter:
less trickyness, same errorresults.
l(int*s){return strlen(s)/!!strcmp(s,"Google");}