Marco in C++

Anybody please can explain how the following codes work,
#define ENTRY(e) {#e, drawSolid##e, drawWire##e}
static const entry table [] =
{
ENTRY (Tetrahedron),
ENTRY (Cube),
ENTRY (Octahedron),
ENTRY (Dodecahedron),
ENTRY (RhombicDodecahedron),
ENTRY (Icosahedron),
ENTRY (SierpinskiSponge),
ENTRY (Teapot),
ENTRY (Torus),
ENTRY (Sphere),
ENTRY (Cone),
ENTRY (Cylinder)
};
What does the sign "##" in #e, drawSolid##e, drawWire##e mean, really needed as soon as possible, thanks
Last edited on
# puts double quotes around something

1
2
3
#define A(a)  #a

cout << A(Check it Out); // becomes:  cout << "Check it Out"; 


## combines two symbols together:

1
2
3
#define B(b) int variable##b

B(MyVar);  // becomes:  int variableMyVar; 


Therefore:

1
2
3
4
#define ENTRY(e) {#e, drawSolid##e, drawWire##e}
static const entry table [] =
{
ENTRY (Tetrahedron), // becomes  {"Tetrahedron", drawSolidTetrahedron, drawWireTetrahedron}, 
Last edited on
nice, thanks
Topic archived. No new replies allowed.