Re: [cc65] malloc and Sort.c(26): Error: Expression expected

Date view Thread view Subject view

From: Marko Mäkelä (marko.makela_at_hut.fi)
Date: 2003-03-04 12:20:06


On Tue, Mar 04, 2003 at 12:12:46PM +0100, Ullrich von Bassewitz wrote:
> In C, the cast is not needed, and the argument to the sizeof operator is not
> valid. Use
> 
>         ra = (unsigned int*) malloc (size * sizeof unsigned);

Is "sizeof unsigned" a valid C expression?  I think (and gcc agrees with
me) that you should use parentheses when determining the storage size of
a data type, as in "sizeof (unsigned)".  If you omit the parentheses,
the argument to sizeof should be a valid expression, which "unsigned" is
not, as it cannot be the name of a constant or variable.

	Marko
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-03-04 12:22:14 CET