Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!decvax!genrad!mit-eddie!think!harvard!seismo!brl-tgr!tgr!gwyn@BRL.ARPA From: gwyn@BRL.ARPA (VLD/VMB) Newsgroups: net.lang.c Subject: Re: Dumb question on dyn. mem. alloc (if(hate(novices)) dont_read();) Message-ID: <41@brl-tgr.ARPA> Date: Sat, 20-Jul-85 23:38:50 EDT Article-I.D.: brl-tgr.41 Posted: Sat Jul 20 23:38:50 1985 Date-Received: Sun, 21-Jul-85 23:31:27 EDT Sender: news@brl-tgr.ARPA Lines: 17 Unless someone has patched your version of "lint" to handle malloc() as a special case, there is no way to avoid warnings about possible pointer alignment problems. That is because casting from a (char *) to a (foo *) is not possible in general. Malloc() has been specially designed to ensure that its returned (char *) IS properly aligned for anything whatsoever. "lint" does not normally know this. By the way, I would discourage using calloc() unless you are allocating an array of (char)s and want them to all be NUL bytes. Since calloc() cannot guess how you are intending to use the storage it allocates, it is unable to fill it with the "right" type of 0 data. You will normally be better off using malloc() and initializing the storage yourself. There aren't many good books in C for the non-novice. You might look at Narain Gehani's "Advanced C: Food for the Educated Palate" (Computer Science Press, 1985).