The FAQ page ..

Unknown W. Brackets unknown at simplemachines.org
Sat Aug 5 15:38:11 PDT 2006


Under:

When should I use a foreach loop rather than a for?

This example:

T* end = &foo[length];
for (T* p = &foo[0]; p < pend; ++p)

Is incorrect.  It should be:

T* pend = &foo[length];
for (T* p = &foo[0]; p < pend; ++p)

The same mistake repeats in the next example.

-[Unknown]


> This has probably been brought up more than once! but oh well,
> The faq page is misleading,
> http://digitalmars.com/d/faq.html
> It's old, contains false and/or useless statements, such as this:
> 
> [quote]
> Why is [expletive deleted] printf in D?
> 
> printf is not typesafe. It's old fashioned. It's not object-oriented. 
> It's not usable with user-defined types. printf is guilty as charged. 
> But it's just so darned useful. Nothing beats it for banging out a quick 
> dump of a value when debugging.
> 
> Note: printf is actually not really part of D anyway, but since D 
> provides easy access to C's runtime library, D gets it when needed.
> 
> [/quote]
> 
> Shouldn't the answer to that should be more like:
> printf is not part of D, and its use is *not* recommended, use 
> std.stdio.writef and std.stdio.writefln isntead.
> 
> 
> and:
> [quote]
> Will D be open source?
> 
> The front end for D is open source, and the source comes with the 
> compiler. There is a SourceForge project underway to create a Gnu 
> implementation of D from this.
> [/quote]
> I guess gdc hasn't been released yet <g>
> 
> The question (and answer to) "How do I get printf() to work with 
> strings?" is totally useless and misleading. I was a victim of it for a 
> long time .. that is, before I discovered writefln, which wasn't at the 
> time mentioned very much on the site, if ever.
> If the question must stay, then shouldn't the answer be something like 
> "Just use writef, it works with D string automagically!".
> 
> That's all I found (for now at least .. )



More information about the Digitalmars-d mailing list