On Fri, 2008-02-01 at 16:26 -0800, exander77@[EMAIL PROTECTED]
wrote:
> I am quite new to c++, about half of a year.
> I juct wonder, why such code is not possible:
>
> int chlen(char * ar) {
> for(int i=0;ar[i]||return i;i++);
> }
because it is totally unreadable?
> In my opinion, it would be much "cuter" than this:
>
> int chlen(char * ar) {
> int i;
> for(i=0;ar[i];i++);
> return i;
> }
Why not:
int chlen(char * ar)
{
char *arc = ar;
while (*arc) ++arc;
return arc - ar;
}
--
Tristan Wibberley
Any opinion expressed is mine (or else I'm playing devils advocate for
the sake of a good argument). My employer had nothing to do with this
communication.