Help me interpret the C code

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help me interpret the C code

Emeka
Hello All,


#define rawgco2ts(o)    check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))

#define check_exp(c,e)          (e)

I can't figure out where/how the conditional is used.

Regards, \Emeka
--
Satajanus  Nig. Ltd


Reply | Threaded
Open this post in threaded view
|

Re: Help me interpret the C code

Coda Highland
On Tue, Sep 2, 2014 at 3:38 PM, Emeka <[hidden email]> wrote:

> Hello All,
>
>
> #define rawgco2ts(o)    check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
>
>
> #define check_exp(c,e)          (e)
>
>
> I can't figure out where/how the conditional is used.
>
>
> Regards, \Emeka
>
> --
> Satajanus  Nig. Ltd
>
>

It's not. Look at the *other* definition of check_exp.

#define check_exp(c,e)          (lua_assert(c), (e))

http://www.lua.org/source/5.1/llimits.h.html

/s/ Adam

Reply | Threaded
Open this post in threaded view
|

Re: Help me interpret the C code

Emeka


On Tue, Sep 2, 2014 at 11:46 PM, Coda Highland <[hidden email]> wrote:
On Tue, Sep 2, 2014 at 3:38 PM, Emeka <[hidden email]> wrote:
> Hello All,
>
>
> #define rawgco2ts(o)    check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
>
>
> #define check_exp(c,e)          (e)
>
>
> I can't figure out where/how the conditional is used.
>
>
> Regards, \Emeka
>
> --
> Satajanus  Nig. Ltd
>
>

It's not. Look at the *other* definition of check_exp.

#define check_exp(c,e)          (lua_assert(c), (e))

http://www.lua.org/source/5.1/llimits.h.html

/s/ Adam




--
Satajanus  Nig. Ltd


Reply | Threaded
Open this post in threaded view
|

Re: Help me interpret the C code

Coda Highland
On Tue, Sep 2, 2014 at 3:58 PM, Emeka <[hidden email]> wrote:
> Adam,
>
>
> Thanks but check, http://www.lua.org/source/5.2/llimits.h.html#check_exp

Look up, five lines. It's the same in 5.1 and 5.2.

/s/ Adam