extracrispy
extracrispy

Reputation: 679

What in the world does this mean (C++ function pointer)?

So I was looking at some c++ source code and wanted to know just what the heck this meant. I think it means call tmp as a function but I'm not sure.

char* tmp;
///stuff filling tmp with values
((void (*)())tmp)();

Upvotes: 3

Views: 172

Answers (1)

Fred Larson
Fred Larson

Reputation: 62063

Yes, it's casting tmp as pointer to a function that accepts no arguments and returns nothing, then calling it.

Looks like a recipe for disaster, if you ask me.

Upvotes: 7

Related Questions