Reality drives me to write less clean code, sorry for mistakenly posting in D.announce

Mike Parker aldacron71 at yahoo.com
Thu Oct 11 20:09:43 PDT 2007


davidl wrote:
> 
> First practice:
> 
> char[] text;
> char* p;
> char* end;
> 

Pointer arithmetic in D is a no-no, unless you are using memory 
allocated outside of the GC. To iterate over a D string, or any array, 
use foreach:

foreach(c; text)
{
    // do something with c
}



More information about the Digitalmars-d mailing list