This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Q. is sizeof(char) always 1


On Fri, 25 Sep 1998 grahams@rcp.co.uk wrote:

> The reason I'm asking this question is a lot of code
> in egcs assumes that sizeof(char) is 1 when allocating

According to the C specification, sizeof( char ) == 1 always.

I'm not 100% sure the Unicode implications of this.

> For example there are calls such as
>  p = (int *)xmalloc(N * sizeof(int *))

This is most definately incorrect.  Either p needs to be an int ** or the
sizeof be applied to an int, though I'm no expert.  ;-)

Christopher



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]