Hi,

C++ has this thing called a preprocessor. It runs over the source code
before it gets to the compiler, and can do a bunch of things like handling
macros, and various conditional compilation directives.

A macro is like a snippet, that can support patterns being swapped in. When
you use a macro, the preprocessor swaps in the literal code in place of the
macro, and swaps in any variables you might have used for the macro. For
instance, CHECK_MSTATUS_AND_RETURN_IT is a macro that takes a status. That
macro expands into the same logic you would write, yourself, checking the
status and returning if its an error.

Basically just think of macros as text replacement. They are less preferred
nowadays, as far as I understand, because they are harder to debug, and are
not type safe.

Justin


On Wed, May 13, 2015 at 3:04 AM illunara <cb.illun...@gmail.com> wrote:

> Hi everybody
> Maya's macro like check_mstatus_and_return_it used a lots. I just a bit
> confuse about how it works. In the document said, { Return if status is not
> MStatus::kSuccess
> <http://download.autodesk.com/us/maya/2010help/API/class_m_status.html#56eb564815df5f0ce06701dd325dc199b7a8c6b1718d8f48d382f568890b7a8f>.
> }
>
> How can a macro stop the function and return immediately without calling
> return? This question is a bit outside Maya's boundary, but i got curious
> and can't help it. Still looking for source to see how it works through :D
>
> And thank for dropping by :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/ec22387e-ea48-4e3f-9a6e-3ba90ba1a398%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/ec22387e-ea48-4e3f-9a6e-3ba90ba1a398%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0q9UNU8nUpS4W6rUrxoytuHubqdWFX4qt0Omp5xRCfgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to