[U-Boot-Users] PATCH for cmd_mem.c:do_mem_mtest()

Jerry Van Baren gerald.vanbaren at smiths-aerospace.com
Tue Sep 13 22:08:39 CEST 2005


Wolfgang Denk wrote:
> In message <43271DD7.1050003 at smiths-aerospace.com> you wrote:
> 
>>>	#define CFG_MEMTEST_SCRATCH (--end)
> 
> ...
> 
>>I'm not sure you want that, exactly.  You are affecting the variable 
>>"end" as a side effect in a macro which is generally a bad idea.  A no 
>>side effect version would be:
>>#define CFG_MEMTEST_SCRATCH (end - 1)
> 
> 
> That would mean that *end is included in testing, and used as scratch
> cell at the same time --> will not work.
> 
> 
>>You are also making assumptions on the type of end (the variable, that 
> 
> 
> No. Just,  that  it  has  the  same  type  as  the  "dummy"  variable
> initilaized by CFG_MEMTEST_SCRATCH
> 
> 
>>#define CFG_MEMTEST_SCRATCH ((void *)end - 1)
> 
> 
> That would be definitely worse.
> 
> Best regards,
> 
> Wolfgang Denk

Ahh, you _did_ intend the side effect.  You are being trickier than I 
gave you credit for.  Please disregard my interference...

gvb




More information about the U-Boot mailing list