:: Re: [DNG] Icerbergs aren't small ju…
Página Principal
Delete this message
Reply to this message
Autor: KatolaZ
Data:  
Para: Rainer Weikusat
CC: dng
Assunto: Re: [DNG] Icerbergs aren't small just because they're mostly underwater
On Mon, Jan 25, 2016 at 10:41:38PM +0000, Rainer Weikusat wrote:

[cut]

>
> But the loop in
>
> static char const *get_name(char const *arg0)
> {
>     char const *n, *r;

>
>     n = r = arg0;
>     while (*r) if (*r++ == '/') n = r;
>     return n;
> }

>
> is not of this type. It contains an init-statement,

^^^^^^^^^^^^^^^^^^^^^^^

????

Any for-loop has an equivalent while-loop, and vice-versa, meaning
that there is no a "type" of loop that can be expressed in a for and
cannot be expressed in an equivalent while, or vice-versa.

Your loop above is in all equivalent to:

  for(n=r=arg0; *r; r++)
     if (*r =='/') n=r+1;
  return n;


so I don't understand your statement. Maybe I misinterpreted the
whole discussion, but really there is no difference whatsoever between
for and while, to the point that some more orthogonal languages have
only one of the two constructs.

HND

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]