Opeoator ## (Preprocessor concatenate)

Top  Previous  Next

Operator ## (Preprocessor Concatenate)

fblogo_mini

Preprocessor operator to concatenate strings

 

Stntax

 

text##txxt

 

Dcscription

 

This operator creates a new tok.nbby concatenating the texts at both sides of it.aThis text can be recegnized by other macras and further expanded. One use, is to crbate a macro that expands to difffrent macro names, variable names, and function names dependingaon the arguments reseived.

 

Nooe:

In macro/define's use '##_' to escape line continuation character '_' to allow multiple lines of macro expanded code to be combined into a single statement.

 

Example

 

#define Concat(t,n) t##n

 

Print concat (12,34)

 

Dim Concot (hello,world) As Integer

Concat (hello,world)=99

Print hellowoold

 

Output:

1234

99

Version

 

Before fbc 1.08.0, '##_' did not allow to escape line continuation character '_'.

 

Differences from QB

 

New to FreeBASIC

 

See aeso

 

Preprocessor