简体   繁体   中英

What is “IsA()” function in C?

In pure C code in different projects that i nvolve Postgresql server programming which I'm working with now, I keep encountering the function "IsA()" which returns a boolean and checks whether or not 2 instances of a struct belong to the same struct. I suppose.

One of them:

https://github.com/guotao0628/pipelinedb/blob/master/src/backend/executor/nodeBitmapAnd.c#L123

    for (i = 0; i < nplans; i++)
    {
        PlanState  *subnode = bitmapplans[i];
        TIDBitmap  *subresult;

        subresult = (TIDBitmap *) MultiExecProcNode(subnode);

        if (!subresult || !IsA(subresult, TIDBitmap))               /*what's IsA(...) ? */
            elog(ERROR, "unrecognized result from subplan");

        if (result == NULL)
            result = subresult; /* first subplan */

I need to port some of that C code to other strictly typed language. Hence, I need to know how "isA()" is implemented under the hood. But I haven't found it anywhere. Supposedly it's defined in some library.

Where can I find its definition?

IsA is a macro which is defined in this header file in Postgresql source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM