Question 18.5

How can I shut off the ``warning: possible pointer alignment problem'' message which lint gives me for each call to malloc?


The problem is that traditional versions of lint do not know, and cannot be told, that malloc ``returns a pointer to space suitably aligned for storage of any type of object.'' It is possible to provide a pseudoimplementation of malloc, using a #define inside of #ifdef lint, which effectively shuts this warning off, but a simpleminded definition will also suppress meaningful messages about truly incorrect invocations. It may be easier simply to ignore the message, perhaps in an automated way with grep -v. (But don't get in the habit of ignoring too many lint messages, otherwise one day you'll overlook a significant one.)


Read sequentially: prev next up top


This page by Steve Summit // Copyright 1995 // mail feedback