[M3devel] Enumeration or subrange value out of range

Jay K jay.krell at cornell.edu
Tue Nov 30 18:18:10 CET 2010


> C++ managed to make linkers the world over vastly more ocmplex.  It's 
> the linker that discovers that some templates haven't been compiled yet 
> and calls the compiler to compile them.  I really don't think linkers 
> should be all *that* language-dependent.

This is actually unfortunately false.
C++ requires no or almost no linker support.
Inline functions often use linker features that C didn't need.
Templates do not.
What really happens is templatized code is fully in headers.
Which does have drawbacks -- large headers, slow compile.

There was an implementation where the compiler looked at the linker
errors. But I don't think any such implementation is in use today.


> Is finding the right template to instantiate with the right 
> parameters always unambiguous?

When it is ambiguous, there is an error.

int i; long j;
max(i,j);
=> error

> That's the standard practice in C++.  To introduce complicated 
> mechanisms tso that the programmer, with sufficient effort, can mimic 
> features that should better have been reliably built into the language 
> in the first place.

In the case of templates leading to some meta programming, it was an accident.
But in the case of operator overloading it seems just goodness.

 - Jay

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20101130/af32a440/attachment-0002.html>


More information about the M3devel mailing list