[Pyrex] Total newbie needs code review

John Machin sjmachin at lexicon.net
Mon Sep 12 04:21:00 CEST 2005


Grant McDonald wrote:

> > Should'nt this be:
> >
> > copy = <char *>PyMem_Malloc( (len(pyString) + 1) * sizeof(char) )
> >
> Yes. That's what i meant :)
>
> > According to K&R v2 p204, sizeof(char) == 1; pretend you are an
> > optimising compiler and see what you get.
>
> A good reason to always be explicit in what you want. Assumptions 
> always cause problems at some point!
>
It's not an assumption; sizeof(char) is defined to be 1.



More information about the Pyrex mailing list