freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT schemamania.org>
- To: TDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] too many casts, sire
- Date: Tue, 6 Apr 2004 23:15:31 -0400
http://www.fiendish.demon.co.uk/c/casting.html
http://www.vmunix.com/~gabor/c/draft.html#6.2.2.3
I came across this line in bcp.c (reformatted):
if ((curptr->nextptr =
(struct fflist *) malloc(sizeof(struct fflist)))
== (struct fflist *) NULL)
ANSI C says:
1. It's never necessary to cast to compare to a null pointer.
2. It's never necessary to cast void* for assignment.
That tells me this could as well read:
if ((curptr->nextptr =
malloc(sizeof(struct fflist))) == NULL)
which I can actually read. Is there any reason not to simplify this? Is
anyone really using a malloc() that returns char* in 2004? (The casting
of NULL is just plain egregious, not merely old fashioned.)
--jkl
-
[freetds] too many casts, sire,
James K. Lowden, 04/06/2004
- <Possible follow-up(s)>
- RE: [freetds] too many casts, sire, Thompson, Bill D (London), 04/13/2004
-
RE: [freetds] too many casts, sire,
Lowden, James K, 04/13/2004
- RE: [freetds] too many casts, sire, Michael Peppler, 04/13/2004
- RE: [freetds] too many casts, sire, brian, 04/13/2004
Archive powered by MHonArc 2.6.24.