On Friday, June 24, 2011 10:39:29 Jie Zhang wrote: > On Fri, Jun 17, 2011 at 4:39 PM, Mike Frysinger wrote: > > On Friday, June 17, 2011 16:09:47 Jie Zhang wrote: > >> On Fri, Jun 17, 2011 at 1:58 PM, Mike Frysinger wrote: > >> >> + q = (struct flash_block *) malloc (sizeof (struct flash_block)); > >> > > >> > no need for the cast, and i'd use sizeof (*q) > >> > >> OK. Seems I'm still living in old days. > > > > it's needed in C++ code, but that's not what urjtag is written in :) > > malloc returned "char *" in old days.
ah, that's before me. C++ doesnt like converting void* to other stuff whereas C has no problems. > >> >> + const char *ex_short = "[firmware=FILE]"; > >> >> + const char *ex_desc = "FILE Upgrade the ICE firmware. See > >> >> this > >> > > >> > page:\n" > >> > > >> > const char foo[] = "..." > >> > >> Why? > > > > one less pointer. compare the assembly output: > > $ echo 'const char foo[] = "asdf";' | gcc -S -o - -x c - > > $ echo 'const char *foo = "asdf";' | gcc -S -o - -x c - > > But when it's passed as an argument, the former will pass the whole > string but the latter will only pass a pointer. no it wont. in both cases, passing it as an argument will pass a pointer. > I also found I forgot to reply your comment on extracting the CRC > function. There are many kinds of CRC algorithms. So even in future > another part of UrJTAG uses a CRC function, it might use a different > one. So I still prefer to keep it in ice100b.c. fair enough dont have any more feedback on this patch -mike
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________ UrJTAG-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/urjtag-development
