Breaking changes in Visual C++ 2015

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sat May 9 16:25:15 PDT 2015


On Sat, May 09, 2015 at 03:44:40PM -0700, Walter Bright via Digitalmars-d wrote:
> On 5/9/2015 1:57 PM, Nick Sabalausky wrote:
> >On 05/08/2015 06:58 PM, Walter Bright wrote:
> >>On 5/8/2015 2:51 PM, deadalnix wrote:
> >>>The way you end runnign all kind of test with the ones you are
> >>>interested in makes no sense.
> >>
> >>    dmd std/path -unittest -main
> >>
> >>runs just the unit tests in std/path. You can run tests in some
> >>modules, but not others, with:
> >>
> >>    dmd -c a b c -unittest
> >>    dmd d e f a.o
> >>    ./d
> >>
> >
> >That breaks most build systems, including rdmd.
> 
> 
> Build systems cannot handle giving different compile flags to
> different files? Back to using 'make' :-)

Of course it can. I have done it before, it's not that hard. (And build
systems that don't support that, suck. :-P)

The more enlightening question is, why is it a bad idea to give
different compile flags to different files? And the answer is that it's
not a recommended setup, as you may cause subtle breakage between
modules that may lead to hard-to-find heisenbugs that only show up at
runtime but don't exist in code.

Contrived example:

	module mymod;
	version(UseFloat) float x;
	else int x;

	module main;
	import mymod;
	void main() {
		x = 0;
		writeln(x);
	}

Compile commands:

	dmd -c mymod.d
	dmd -c -version=UseFloat main.d		# <-- oops
	dmd -ofprog main.o mymod.o


T

-- 
A linguistics professor was lecturing to his class one day. "In English," he said, "A double negative forms a positive. In some languages, though, such as Russian, a double negative is still a negative. However, there is no language wherein a double positive can form a negative." A voice from the back of the room piped up, "Yeah, yeah."


More information about the Digitalmars-d mailing list