Logo

Programming-Idioms

Assign, at runtime, the compiler version and the options the program was compilerd with to variables version and options, respectively, and print them. For interpreted languages, substitute the version of the interpreter.

Example output:

GCC version 10.0.0 20190914 (experimental)
-mtune=generic -march=x86-64
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
use iso_fortran_env
  character(len=:), allocatable :: version, options
  version = compiler_version()
  options = compiler_options()
  print *,version
  print *,options
import "runtime"
version := runtime.Version()
version = GroovySystem.version
const { version } = process;
console.log(version);
print(_VERSION)
writeln({$I %fpcversion%});
use Config;
my $version = $Config{version};
my $version_for_humans = $Config{version_patchlevel_string};
my %options = %Config{qw(config_args cccdlflags ccdlflags ccflags lddlflags libs)};
$version = "$]";
import sys
version = sys.version
options = sys.flags
puts version = RUBY_VERSION