POV-Ray : Newsgroups : povray.general : #version directive : Re: #version directive Server Time
29 Apr 2024 14:37:27 EDT (-0400)
  Re: #version directive  
From: clipka
Date: 8 Feb 2018 12:32:35
Message: <5a7c89b3@news.povray.org>
Am 08.02.2018 um 16:19 schrieb Bald Eagle:

> The thing to do would be to write a short SDL script that sends the value of
> version to the debug stream.
> Then do #version 3.5, do #version version again, and see what version equals.
> In that case, if version winds up being 3.5, then version is a "POV-Ray
> predefined variable", rather than a constant that reflects the version of the
> build.

As a matter of fact, `version` /is/ a keyword, not a constant nor a
predefined variable.

In general, when using the keyword in an expression, it evaluates to the
most recent `#version` statement, `+MV` command-line setting or
`Version` INI file setting.

As an exception, if used in a `#version` statement right at the start of
the scene, it evaluates to the actual software version.

> Perhaps there ought to be a secondary "software_version" or "current_version"
> constant that immutably reflects the software version.

That's problematic, because older versions wouldn't recognize that keyword.

Even if it was implemented in such a way that `#ifdef` could test
whether the value is supported, you'd have to end up using something like:

#ifdef(software_version)
  #version software_version;
#else
  #version 3.7;
#end

Note that such a construct would violate the "version statement first"
constraint, as the first statement would be an `#ifdef` instead.

With the special behaviour of `version` when used in the initial
`#version` statement, you can instead safely use:

    #version version;
    #declare software_version = version;

and go on from there.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.