Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the statements "#pragma managed(push, off)" and "#pragma managed(pop)" mean?

I am looking at some C++/CLI code and have seen a lot of such statements mostly around #includes. What do they mean? I know that they, according to MSDN, Enable function-level control for compiling functions as managed or unmanaged. But I am interested in their inner mechanics especially the push and pop semantics. If someone could explain how either one of the two statements works, I will figure out the other one myself.

like image 243
user467947 Avatar asked Jan 31 '11 11:01

user467947


People also ask

What are do statements?

The do statement is similar to the while statement with an important difference: the do statement performs a test after each execution of the loop body. Here is a counting loop that prints integers from 0 to 9: Notice how the do and the while bracket the statements that form the loop body.

What is a statement example?

A statement is a sentence that says something is true, like "Pizza is delicious." There are other kinds of statements in the worlds of the law, banking, and government. All statements claim something or make a point. If you witness an accident, you make a statement to police, describing what you saw.

Why do we use statement?

We use statement questions when we think we know the answer to the question and we want to find out if we're right. In these cases we can use falling intonation: A: Right, so today is the 8↘th?

What does statement in a sentence mean?

Statements are sentences that express a fact, idea or opinion. Statements do not ask questions, make requests or give commands. They are also not exclamations.


1 Answers

#pragma managed(push, off)

Sets managed compilation option to the code after this line to off, and pushes to the stack previously active managed option.

#pragma managed(pop)

Restores last managed state from the stack. Code between these two lines is compiled as unmanaged. Code after pop line is compiled with the same option, as before the push line, whether it was managed or unmanaged.

like image 71
Alex F Avatar answered Sep 27 '22 19:09

Alex F