On 21/01/2012 11:43, Peter Alexander wrote:
<snip>
size_t is defined in druntime as an alias to uint/ulong.

In C++ too, size_t is defined in the standard library.

The compiler is unaware of any special status that it may have.

The whole point of what I'm saying is that it doesn't need to be.

writefln is a library function. But DMD recognises it specially, so that it can give "perhaps you need to import std.stdio;" if you try using it.

In the same way, it could recognise size_t/ptrdiff_t specially, by treating them internally as strong types even if they aren't - so that if you try to use one as a uint/int, it will give a warning. Just like the M$ C++ compiler does.

OK, so it's simpler if size_t and ptrdiff_t are changed to built-in types, but my point is that it's not strictly necessary.

From what I gather, some C++ compilers do more than this: they have a built-in understanding of the STL types, which they can use to optimise operations on them better than can be done in the code implementations of them.

Stewart.

Reply via email to