[MLton-devel] OS.IO.poll portability
Matthew Fluet
fluet@cs.cornell.edu
Fri, 6 Jun 2003 16:23:20 -0400 (EDT)
> Speaking of poll(), the file mlton/runtime/basis/OS/IO/poll.c from the CVS a
> couple of days ago is not actually legal C (although gcc accepts it). In C,
> stack frames are constant size. You cannot accept a parameter and then
> declare a local variable (ufds in this case) to be an array whose size is the
> value of the parameter.
My gcc man pages say:
Arrays of Variable Length
=========================
Variable-length automatic arrays are allowed in ISO C99, and as an
extension GCC accepts them in C89 mode and in C++. (However, GCC's
implementation of variable-length arrays does not yet conform in detail
to the ISO C99 standard.) These arrays are declared like any other
automatic arrays, but with a length that is not a constant expression.
The storage is allocated at the point of declaration and deallocated
when the brace-level is exited.
If you prefer alloca or malloc/free, that's fine.
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel