enki / libev

Full-featured high-performance event loop loosely modelled after libevent
http://software.schmorp.de/pkg/libev
Other
1.63k stars 444 forks source link

code confused #4

Open jason51285128 opened 5 years ago

jason51285128 commented 5 years ago

I am confused about this line of code:

#define VARx(type,name) VAR(name, type name)

I searched the entire project, and can‘t find definition of macro VAR(name, type name), could you please make a short explain? @enki

h4tr3d commented 5 years ago

Look better ;-) https://github.com/enki/libev/blob/93823e6ca699df195a6c7b8bfa6006ec40ee0003/ev.c#L1818 Commonly used technique: define some approach before include header. Some times it uses as code-generation helper.

jason51285128 commented 5 years ago

Look better ;-) libev/ev.c

Line 1818 in 93823e6

define VAR(name,decl) decl;

Commonly used technique: define some approach before include header. Some times it uses as code-generation helper.

got it! Thanks a lot! @h4tr3d

enki commented 5 years ago

i'd just keep in mind that this is not the official repo but just a manually created woefully out of date copy

On Wed, Mar 27, 2019 at 2:05 AM, hktkzcc < notifications@github.com > wrote:

Look better ;-) libev/ ev. c ( https://github.com/enki/libev/blob/93823e6ca699df195a6c7b8bfa6006ec40ee0003/ev.c#L1818 )

Line 1818 in 93823e6 ( http:///enki/libev/commit/93823e6ca699df195a6c7b8bfa6006ec40ee0003 )

define VAR(name,decl) decl;

Commonly used technique: define some approach before include header. Some times it uses as code-generation helper.

got it! Thanks a lot! @ h4tr3d ( https://github.com/h4tr3d )

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub ( https://github.com/enki/libev/issues/4#issuecomment-476977075 ) , or mute the thread ( https://github.com/notifications/unsubscribe-auth/AABy4480ee65FEhdxijGecCtOfaOIKLGks5vavwjgaJpZM4cM4nT ).

jason51285128 commented 5 years ago

yes, I just wonder how this library working, so I checkout this repository.

dr-begemot commented 5 years ago

You can view the original repository http://cvs.schmorp.de/libev/ Also, there is very good documentation http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod

jason51285128 commented 5 years ago

good links! Thanks! @dr-begemot