On Fri, 17 Aug 2001, David Olofson wrote:
> On Friday 17 August 2001 01:29, Calin Culianu wrote:
> > On Thu, 16 Aug 2001, Victor Yodaiken wrote:
> > > On Thu, Aug 16, 2001 at 04:17:48PM -0400, Calin Culianu wrote:
> > > > Notice that unlike the rtf_put() function in rt-linux, the read()
> > > > system call actually was well enough written to work with void *.
> > > > It escapes me why the rt-linux developers chose char * as opposed
> > > > to void * for their second argument to rtf_put(). All I have seen
> > > > it to do to date was confuse novices. Can anyone enlighten me on
> > > > this fine point?
> > >
> > > Yes. The answer is "lack of thought" - rtf_put was quite early and
> > > the early UNIX "read" was prior to the invention of "void *" so we
> > > didn't think about it.
> >
> > Actually it's pure aesthetics. char * works fine.
>
> Except that you have to do an explicit typecast to keep the C compiler
> from warning and the C++ compiler from refusing to compile.
>
>
> > And you can say
> > that it emphasizes that the third argument is number of bytes.
>
> OTOH, just as sizeof() returns the size in bytes, it makes sense if every
> size argument in every C API uses units.
>
>
> > The
> > only potential theoretical issue is if mankind ever builds a machine
> > that runs rt-linux and that somehow has sizeof(char *) != sizeof(void
> > *). :)
>
> You know, that's not all that unrealistic. Note that some MCUs use
> different memory areas (and different addressing modes) for read-only and
> random access data. And "certain architectures" (read: x86) still support
> obsolete and cumbersome memory models where there can be multiple,
> differently sized kinds of pointers in a system at the same time.
>
> Now, someone else will have to figure out how that would make a void *
> different from a char *. :-)
>
>
> > In that case weird unexpected errors could occur. Hopefully on that
> > machine the compiler will be smart enough to copy the pointers
> > correctly anyway :).
>
> If the pointers would really be different, it's entirely possible that
> they one type can't be translated into the other, and possibly vice
> versa. (Think about near and far pointers; one can be converted into the
> other, but not the other way around - copying the buffer is the only way.)
Actually, maybe I am too young to know this, but what is a far pointer?
Is this a concept used with segmented memory schemes?
>
>
> Uuurgh!!! I have to go and **** or something - too many DOS memories are
> coming back! ;-)
>
>
> //David Olofson --- Programmer, Reologica Instruments AB
>
> .- M A I A -------------------------------------------------.
> | Multimedia Application Integration Architecture |
> | A Free/Open Source Plugin API for Professional Multimedia |
> `----------------------------> http://www.linuxdj.com/maia -'
> .- David Olofson -------------------------------------------.
> | Audio Hacker - Open Source Advocate - Singer - Songwriter |
> `--------------------------------------> [EMAIL PROTECTED] -'
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>
>
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/