need help

Anders F Björklund afb at algonet.se
Tue Apr 25 08:55:56 PDT 2006


Deewiant wrote:

>>When the string contains format characters (that would be '%')
> 
> Ah, of course. Thanks for reminding me, to xs0 as well.

Printf has the same problem. I bet you could trigger some
real nice buffer overflows by abusing this "feature"...

IMNSHO:
Telling newcomers to use printf("Hello") or writef("World")
will just make them shoot themselves in the foot later on.

Whenever you introduce either, you need to talk about "formats".
Which is why it's better if there's an alternative *without* ?

Like in C:
#include <stdio.h>
int main(int argc, char* argv[])
{
   puts("Hello, World!");
   return 0;
}

But that's just what I thought about the issue, nothing new.
(And no, it's not a problem for strings without the percent)

--anders



More information about the Digitalmars-d-learn mailing list