Re: Scheme and libraries -- piggyback on Java?
- From: George Neuner <gneuner2/@comcast.net>
- Date: Thu, 14 Sep 2006 23:42:07 -0400
On Tue, 12 Sep 2006 10:43:06 -0500, Matthias Blume
<find@xxxxxxxxxxxxxxxxxxxx> wrote:
George Neuner <gneuner2/@comcast.net> writes:
Some of the "enhanced K&R" compilers (circa 1977..1985) allowed void
pointers to be assigned to other pointer types without casting.
However, as of C89, casting void pointers has been required just as in
C++.
You are wrong about this:
http://david.tribble.com/text/cdiffs.htm
Whups! You are correct.
I suppose I did know at one time that void* was convertible without
casting, but I learned C during the transition period from K&R to
ANSI/ISO when it was normal to cast malloc() returns even if the
target was a char*. Ditto for parameters to, e.g., memcpy(), even if
the source was a char*. I also did a lot of embedded programming
using a number of differently extended compilers. I thus learned to
explicitly cast all conversions regardless of the theoretical need to
do so ... for code documentation if nothing else.
C89 tightened up many of the loose spots in K&R, and I did read the
spec on several occasions, but I suppose I unconsciously glossed over
the part about void* being compatible with other pointers without
casting.
I also just realized that I haven't used an actual C compiler since
about 1993. Since then, I have always compiled C code with a C++
compiler. With all warnings on, failure to cast to/from a void* gives
a portability warning. Since I would see the warning frequently when
dealing with C code, I guess it just reinforced my flawed
understanding.
Oh well. Live and learn.
George
--
for email reply remove "/" from address
.
- References:
- Scheme and libraries -- piggyback on Java?
- From: prestowk
- Re: Scheme and libraries -- piggyback on Java?
- From: Dragontamer
- Re: Scheme and libraries -- piggyback on Java?
- From: Mallor
- Re: Scheme and libraries -- piggyback on Java?
- From: Dragontamer
- Re: Scheme and libraries -- piggyback on Java?
- From: Rob Thorpe
- Re: Scheme and libraries -- piggyback on Java?
- From: George Neuner
- Re: Scheme and libraries -- piggyback on Java?
- From: Rob Thorpe
- Re: Scheme and libraries -- piggyback on Java?
- From: George Neuner
- Re: Scheme and libraries -- piggyback on Java?
- From: Matthias Blume
- Scheme and libraries -- piggyback on Java?
- Prev by Date: Re: Why cons *pairs*?
- Next by Date: Re: some confusions in this thread (Re: Why cons *pairs*?)
- Previous by thread: Re: Scheme and libraries -- piggyback on Java?
- Next by thread: Re: Scheme and libraries -- piggyback on Java?
- Index(es):
Relevant Pages
|