version()

Manu turkeyman at gmail.com
Mon Jan 16 08:43:20 PST 2012


On 16 January 2012 17:38, Iain Buclaw <ibuclaw at ubuntu.com> wrote:

> On 16 January 2012 14:27, Manu <turkeyman at gmail.com> wrote:
> > On 16 January 2012 15:30, Don Clugston <dac at nospam.com> wrote:
> >>
> >> On 16/01/12 01:08, Jonathan M Davis wrote:
> >>>
> >>> On Monday, January 16, 2012 01:44:56 Manu wrote:
> >>>>
> >>>> Surely basic logical expressions within a version seem not only
> logical,
> >>>> but also very necessary?
> >>>> There must be a reason this is impossible, or else I can't believe
> it's
> >>>> not
> >>>> already like that...
> >>>
> >>>
> >>> People have requested it. Walter is against it. I don't remember his
> >>> exact
> >>> arguments, but he believes that it leads to worse code if you allow it.
> >>>
> >>> As for
> >>>
> >>> version(linux || OSX)
> >>>
> >>> you can use
> >>>
> >>> version(Posix)
> >>>
> >>> It'll include FreeBSD as well, but then again, if something is common
> to
> >>> both
> >>> linux and OSX, then it's almost certainly in FreeBSD as well.
> >>>
> >>> - Jonathan M Davis
> >>
> >>
> >> I think both approaches are wrong. I think the idea approach is to treat
> >> versions as booleans, and have a one-definition rule.
> >>
> >> version VersionIdentifier = VersionExpression;
> >>
> >> extern version VersionIdentifier;
> >> // means this version is set from command line, or is a compiler
> built-in
> >>
> >> VersionExpression:
> >>        VersionExpression && VersionExpression
> >>        VersionExpression || VersionExpression
> >>        !VersionExpression
> >>        ( VersionExpression )
> >>        VersionIdentifier
> >>        true
> >>        false
> >>
> >> version(A)
> >> {
> >>   version = AorNotB;
> >> }
> >> version(B)
> >> {
> >> }
> >> else {
> >>   version = AorNotB;
> >> }
> >>
> >> becomes:
> >> version AorNotB = A || !B;
> >>
> >> Make it illegal to reference a version identifier which hasn't been
> >> declared. Disallow version declarations inside version blocks, and all
> the
> >> spaghetti is gone.
> >
> >
> > Will that work? I don't think it's reasonable to expect all versions to
> be
> > declared in all cases/platforms. There are SSE version identifiers for
> > instance, why would they be defined on a PPC platform? Likewise any
> platform
> > specific features...
> > Otherwise I generally agree. Though again, too much water under the
> bridge
> > to change this decision in the language.
> >
>
> Are there SSE version identifiers?
>

I thought I saw some in Walter's commit?
If not, there probably should be. The compiler receives an SSE level flag
(ie. -msse3, etc), and that level needs to be known to the code at compile
time so the library can adhere to the appropriate level.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120116/ba62dd3e/attachment-0001.html>


More information about the Digitalmars-d mailing list