-2

Is there an ANSI-C compatible event loop, like libev or libevent? My requirement is to compile with -ansi flag.

Thank you.

Pio
  • 4,044
  • 11
  • 46
  • 81
  • 1
    The `gcc -ansi` option is equivalent to compiling in C89. Are you asking whether there is an event library that can be compiled with C89 not using any extensions (such as sockets) that are not part of the Standard C89 Library? If not, why is there a restriction to C89? What is the problem you're seeking to solve? Is this an [XY Problem](http://mywiki.wooledge.org/XyProblem)? – Jonathan Leffler Nov 17 '12 at 18:31
  • 1
    You have already listed two alternatives which are not suitable for you, but you have not told *why*. Describe exactly why those are not suitable, and exactly what features you are looking for. Without this information people cannot help you. – hlovdal Nov 17 '12 at 18:33
  • I have to implement a peer-to-peer system and one requirement is that it must be ansi-c compatible - aka. has to compile with -ansi flag. The above mentioned libraries are not ansi compatible: they give you an error if you try to compile. – Pio Nov 17 '12 at 19:43

1 Answers1

1

You cannot have any strictly ANSI compatible event loop on Linux, because the purpose of an event loop is to multiplex cleverly several inputs; on Linux to do that multiplexing, you have to call some syscalls like poll(2), pselect(2) or friends, and all these syscalls are not standardized in ANSI C (or ISO C99, or ISO C2011), but just in Posix.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547