Proposed improvements to the separate compilation model

Rob T alanb at ucora.com
Tue Mar 5 12:41:13 PST 2013


On Tuesday, 5 March 2013 at 18:00:59 UTC, H. S. Teoh wrote:
[...]
>
> I've actually seen (and fixed) a case of two C functions that 
> were
> declared with the same name in two different libraries, and in 
> one
> module, the wrong library was linked in, thus linking the call 
> to the
> wrong function, causing strange runtime problems that no amount 
> of
> staring at the source code would reveal the reason for. The 
> #include was
> perfectly correct; but the problem was that the declaration was 
> detached
> from the implementation, so the compiler has no way to check 
> for this
> kind of problem.
>

I have been the victim of this sort of insanity enough times to 
never want to have to suffer through it again, that's why I'm 
taking the time to make a case against manual .di maintenance.

Note that one of the main points Andrei wanted to address is the 
desire to prevent unnecessary recompilations if the interface 
does not change despite the implementation changing. Such a thing 
can possibly be achieved by specifying to the compiler a path 
where the .di files are located, the compiler can search and 
parse through the files for matching module names (the files may 
be named differently than the associated module) and compare if 
the interface has changed or not, if not then do not overwrite 
with a fresh copy.

--rt


More information about the Digitalmars-d mailing list