Skip to content

Operator Preprocessor Stringize

Paul Squires edited this page Sep 19, 2026 · 1 revision

Home › Operators › Operator # (Preprocessor Stringize)

Operator # (Preprocessor Stringize)

Preprocessor operator to convert macro arguments to strings

Syntax

#macro_argument

Description

This operator converts the macro_argument into a string whose value is the name of the argument. This substitution is made during the macro expansion, previous to compilation.

Note: because of this feature, care should be taken when using file-handling statements in a macro. Because of potential ambiguity with file-handling statements that take a "#filenum" parameter, iffilenumis one of the macro parameters, it may be necessary to wrap thefilenumexpression in parenthesis (e.g. "#(filenum)"), to separate it from the # sign. Otherwise,filenumwill be stringized in the macro.

Remarks

Differences from QB

  • New to FreeBASIC

See also

Examples

#define SEE(x) Print #x ;" = "; x

Dim variable As Integer, another_one As Integer

variable=1

another_one=2

SEE(variable)

SEE(another_one)

Output:

variable = 1
another_one = 2

Category: Operators
Kind: operator


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally