What is wrong with this program?
hosking at convexs.UUCP
hosking at convexs.UUCP
Thu Aug 15 10:41:00 AEST 1985
Among other things, it looks like you never allocate space for "data" in
your program. You have a pointer, but it doesn't point to anything. On
a Convex C-1, this leads to a core dump when "fread" tries to do a "bcopy"
with a null pointer.... which is invalid as a user address. On VAXen and
other machines, null pointers are valid user addresses, which can make
finding such problems a lot more difficult. One of the biggest problems
in porting 4.2 to a Convex C-1 was exactly this problem... programs tried
to use pointers which had never been initialized.
Hint: Learn about the program "lint" and use it regularly. It might have
saved you a lot of work.
Doug Hosking
Convex Computer Corp.
Richardson, TX
More information about the Comp.lang.c
mailing list