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

Wolfgang Denk wd at denx.de
Tue Sep 13 21:54:42 CEST 2005


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

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Harrison's Postulate:
	For every action, there is an equal and opposite criticism.




More information about the U-Boot mailing list