Why have i++; i–; right after each other?

This was a bug. These lines together result in i being unchanged, so they shouldn’t have been there.

The linked article that introduced nmap was published on September 1 1997. If you look at the SVN repository for nmap at https://svn.nmap.org/nmap, the initial revision checked in on February 10 1998 does not have those lines:

int i=0, j=0,start,end;
char *expr = strdup(origexpr);
char *mem = expr;

ports = safe_malloc(65536 * sizeof(short));
for(;j < exlen; j++) 
  if (expr[j] != ' ') expr[i++] = expr[j]; 
expr[i] = '\0';

So this is something the author found and fixed between publishing the initial nmap source code and the initial checkin to SVN.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)