## in C

Question:

When looking at the BlowFish algorithm, I found the following line:

#define S(x,i) (SBoxes[i][x.w.byte##i])

What does ## mean?

Answer:

This is a string concatenation.

In this case, the value of the macro parameter is "glued" to byte

Let's say the macro was called with the parameters var and 1 , then

S(var, 1)

will be replaced by the preprocessor with

(SBoxes[1][var.w.byte1])

and the call

S(var, str)

on

(SBoxes[str][var.w.bytestr])

etc

Scroll to Top