[Tutor] help with translating a c function to a python function
shawn bright
nephish at gmail.com
Thu Jul 5 19:52:22 CEST 2007
Thanks Alan,
so do you think my translation is close?
i do not know a lick of c. Nope, not one line.
thanks
shawn
On 7/5/07, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
> "shawn bright" <nephish at gmail.com> wrote
> while (usDataLen––)
> {
> uIndex = uchCRCHi ^ *puchMsgg++ ;
> uchCRCHi = uchCRCLo ^ auchCRCHi[uIndex} ;
> uchCRCLo = auchCRCLo[uIndex] ;
> }
> return (uchCRCHi << 8 | uchCRCLo) ;
> }
>
> > this part ' auchCRCHi[uIndex};
> > it looks like a typo, because there is a closing } that does not
> > match
> > the opening [.
>
> Its probably a typo but there is one (pretty remote, and horrible)
> possible way for it to be valid which is if uIndex is a macro that
> expands to complete the square bracket expression and introduce
> an expression which needs a brace to finish it. But thats
> just perverse, so I think its a mistake! (Especially since I just
> noticed uIndex is used elsewhere without any closing brace)
>
> Alan G.
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list