Article View: comp.lang.c.moderated
Article #2468Re: Annotations on K&R II
From: Jerry Coffin
Date: Tue, 02 Apr 1996 12:38
Date: Tue, 02 Apr 1996 12:38
40 lines
2271 bytes
2271 bytes
In article <4jq1eq$a3c@solutions.solon.com>, jamie@csd.uwo.ca says...
[ ... ]
> ANNOTATIONS ON K&R II
> p. 135 As the text states: sizeof *x is the size of the
> pointer not the x being pointed to.
I think this bears a bit of clarification: given a definition something like:
something *x;
sizeof(*x);
does NOT give the size of a pointer at all, it gives the size of a `something'
I think you're trying to say that it doesn't give the size of the block
actually pointed to by `x', which is also true.
> p. 119 Note that: 1) char * is not the same as void *
> and 2) this qsort() is not necessarily the same
> as the standard library's. (I got these points
> from a comment on p. 229 (question 13.8) of
> Steve Summit's C Programming FAQs.)
While `char *' and `void *' are not the same, they are required to have the
same representation. (The general idea seems to be that if you pass one in
place of the other, it probably shouldn't cause a problem, but they never
quite state that explicitly. I presume this was an attempt at enforcing
compatibility with older libraries that expected a `char *' where a `void *'
is now indicated.)
> p. 183 <sys/types.h> does not define size_t. It is
> defined in <stddef.h> (pp. 260-1).
If memory serves, under POSIX, sys/types.h is required to define size_t as
well. sys/* are NOT defined by the C standard at all. size_t is required to
be defined in string.h, stdlib.h and time.h in addition to stddef.h, for what
little it may be worth.
Later,
Jerry.
Technical Details
Message-ID:
<4jr73o$h87@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4jq1eq$a3c@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: jcoffin@rmii.com (Jerry Coffin) Newsgroups: comp.lang.c.moderated Subject: Re: Annotations on K&R II Date: 2 Apr 1996 06:38:16 -0600 Organization: TAEUS Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4jr73o$h87@solutions.solon.com> References: <4jq1eq$a3c@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com X-Newsreader: MicroPlanet News32 v1.00 Beta Build 302