Skip to content

Modern Mode

Narta Xaymar Dirks edited this page Nov 27, 2026 · 2 revisions

Modern mode

BlitzLLVM builds programs the way the original does, quirks included, so that old programs keep working. A few of those quirks have a better alternative that changes what a program does, so they are off unless the program asks for them. Modern mode asks for all of them at once:

;#pragma modern
Type Player
	Field lives% = 3
End Type
p.Player = New Player
Print p\lives ; 3 in modern mode, 0 in the original.

The original Blitz3D and BlitzPlus see a comment and build the program as always, so one file works in both.

The features

Pragma Option of blitzcc What it does
modern --modern All of the features below.
sane-evaluation-order --sane-evaluation-order Arguments, operators, array indices and stores are evaluated from left to right, see Language Quirks.
field-defaults --field-defaults New sets fields to their default values (Field lives% = 3), see Language Quirks.
entity-overrides --entity-overrides EntityColor, EntityAlpha, EntityFX, EntityShininess and PaintEntity replace what the brushes of a model say, instead of being combined with them (colors and alphas multiplied, FX OR'd, shininess added). Only what the program set on the entity counts.

modern always means every feature of the BlitzLLVM that builds the program, so a newer BlitzLLVM can add more. A program that has to stay the same lists the features it wants instead of modern. no- in front of a name turns a feature off again, and the last pragma for a feature wins:

;#pragma modern no-field-defaults

Several names can be on one line, separated by spaces or commas, or on several ;#pragma lines. Names don't care about upper or lower case.

Where it goes

These pragmas belong in the comments at the top of the main file, the one given to blitzcc, before its first statement. Empty lines and other comments may come before them. After the first statement they do nothing and warn pragma-misplaced.

The main file decides for the whole program, Included files too: a Type from an included file is used by the code of the main file, so both have to agree on how it works. An included file can say what it was written for with the same pragmas. If that doesn't match the program, it warns pragma-mismatch, and the file is still built the way the main file says:

lib.bb:1:10: warning: 'lib.bb' was written for a program that evaluates from left to right, but this one evaluates in the order of the original. [-Wpragma-mismatch]

The pragmas of the main file win over the options of blitzcc, and the options win over the default of the original. A name that this BlitzLLVM doesn't know warns pragma-unknown and does nothing, so a program for a newer BlitzLLVM still builds.

Warnings

The same ;#pragma line can change the warnings from where it is on, for example ;#pragma Wno-implicit-variable or ;#pragma warning(push). Unlike the features, these can be anywhere and carry through Include like in C, see Warnings.

In the editor

The Visual Studio Code extension shows the warnings above while typing.

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally