Final by default?

Johannes Pfau nospam at example.com
Mon Mar 17 11:31:24 PDT 2014


Am Mon, 17 Mar 2014 08:35:45 +0000
schrieb Iain Buclaw <ibuclaw at gdcproject.org>:

> > If you need to -fversion=CAIRO_HAS_PNG_SUPPORT for every file that
> > imports it, you have completely misunderstood the design I
> > suggested.
> >
> > 1. Encapsulate the feature in a function.
> >
> > 2. Implement the function in module X. Module X is the ONLY module
> > that needs the version. In module X, define the function to do
> > nothing if version is false.
> >
> > 3. Nobody who imports X has to define the version.
> >
> > 4. Just call the function as if the feature always exists.
> >

Clever, but potentially dangerous once cross-module inlining starts
working (The inlined code could be different from the code in the
library).


More information about the Digitalmars-d mailing list