Re: PATCH: Problem union comparision in TUI

Daniel Jacobowitz
2005-10-19T12:28:28Z

On Wed, Oct 19, 2005 at 10:48:53AM +0100, Andrew STUBBS wrote:
> Is there any reason for using a union here? It's not like one value is
> float and the other int - both are ints and the fact that you can't tell
> which you are using shows nobody actually uses the distinction (unless I
> have missed something). The union doesn't save any space, nor does it
> make the code any more efficient.
>
> We could just use:
>
> CORE_ADDR line_or_address;
>
> and leave it at that.

I'd rather that.

It seems possible to figure out which one it's using - always file line
numbers for source displays and addresses for assembly displays.

if ((win == TUI_SRC_WIN
&& bp->source_file
&& (strcmp (src->filename, bp->source_file) == 0)
&& bp->line_number == line->line_or_addr.line_no)
|| (win == TUI_DISASM_WIN
&& bp->loc->address == line->line_or_addr.addr))

But why bother...

--
Daniel Jacobowitz
CodeSourcery, LLC