[Mesa-dev] [PATCH 3/9] Don't cast the return value of malloc/realloc

Alan Coopersmith alan.coopersmith at oracle.com
Wed Sep 5 10:22:49 PDT 2012


On 09/ 5/12 10:16 AM, Matt Turner wrote:
> On Wed, Sep 5, 2012 at 7:30 AM, Brian Paul <brianp at vmware.com> wrote:
>> So assigning a void pointer to a non-void pointer is legal in C and illegal
>> in C++.  I seem to recall some people compiling all of Mesa with C++ in some
>> situations in the past.  Also, there were some C compiler(s) years ago that
>> required these casts (can't remember which).
> 
> That would be interesting to know.

The historical problem I remember was pre-ANSI C89, when compilers either didn't
have (void *) so had malloc return (char *) or didn't have a header providing a
declaration of malloc before C added function prototypes.   I don't think any
such compilers can still be used to build Mesa.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the mesa-dev mailing list