On Tue, May 26, 2009 at 06:56:14PM +0200, Szabolcs Nagy wrote:
It's possible to write portable code that utilizes platform (or
architecture) specific code. You need to segregate the portable
portions from the unportable portions, so that porting only
requires writing some system call stubs for each new host OS,

i agree mostly, but in an ideal world syscalls would be those
"unportable stubs" themselfs, hence my comment

That's exactly what I said. The basic system calls are defined by POSIX. Aside from that, you need architecture and system-specific long jump procedures, among other things, and ideally some tuned string and math procedures.

however i still maintain that a posix conformant, portable lib is
unreasonably difficult (even a posix conformant portable ioctl
implementation would be a hell..)

I don't agree.

Malloc can be implemented in pure C, assuming that the library
already implements mmap or sbrk.
i meant standard c, but yes malloc is not the best example so add
signal and raise to the list instead

There's no reason that signal(2) and raise(2) can't be implemented in pure C, aside from the usual syscall machinery. They're usually implemented as system calls.

--
Kris Maglione

I have always found that plans are useless, but planning is
indispensable.
        --Dwight Eisenhower


Reply via email to