Programming Language for Games, part 3

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 1 18:48:44 PDT 2014


On Sun, Nov 02, 2014 at 01:25:23AM +0000, bearophile via Digitalmars-d wrote:
[...]
> I regard D writefln as currently _broken_. D has static typing,
> templates and compile time execution, and yet such things are not used
> enough in one of the most common functions, the one to print on the
> console. Now even GCC catches many of those printf usage bugs at
> compile-time.
[...]

GCC verification of printf usage bugs is a hack. It's something
hardcoded into the compiler that only works for printf formats. You
cannot extend it to statically verify other types of formats you might
want to also verify at compile-time.

While writefln can be improved (Andrei has preapproved my enhancement
request to support compile-time format string, for example), there's no
way to make such improvements to GCC's format checking short of
modifying the compiler itself.


T

-- 
Real Programmers use "cat > a.out".


More information about the Digitalmars-d mailing list