[Ecls-list] Problem building from git
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at googlemail.com
Fri Feb 6 17:45:09 UTC 2009
On Tue, Feb 3, 2009 at 12:24 PM, Geo Carncross <geocar at gmail.com> wrote:
>> My personal inclination would be to use a union of void* and int,
>> and select the appropriate field, thereby not depending on any
>> implementation defined assumption at all. That also would
>> make the intent clearer.
>
> I agree, but it seems like a lot of the stdio code is getting ripped out in
> favor of posixish reads and writes which means it might really become an int
> soon :)
I will probably end up using the union. The introduction of POSIX
open/close/read/write instead of Ansi fopen/fclose/fread/fwrite is
here to stay, but it is not going to replace the latter.
The reasons are multiple and have to do with 1) buffering and 2)
thread safety. If we go with POSIX files we would have to completely
reimplement both things, while Ansi streams are pretty good at doing
that already. OTOH, by having POSIX files anyone who cares about raw
speed, or who needs to handle these objects directly, can do it, but
with care.
At some point I did not think this way. I was of the opinion, like
that old c.l.l. poster Naggum, that the operating system should be
good enough at buffering and that doing our own buffer operations is a
waste of time. However, it seems that current C libraries implement
read/write as little else than system calls and when you replace Ansi
streams with POSIX streams (see c/file.d at the end for how to do it),
the whole of the I/O becomes too slow.
Ok, just random thoughts. I have to remind myself to do that union thing change.
Juanjo
--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28009 (Spain)
http://juanjose.garciaripoll.googlepages.com
More information about the ecl-devel
mailing list