lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Daurnimator wrote:
> On 31 March 2011 03:53, Mike Pall <> wrote:
> > Look at the error message. You can compare two pointers, but not
> > two aggregates.
> But surely you can see that the aggregates are the same type, and
> located at the same place in memory: how could they ever not be equal?

That doesn't make it a well-defined or even a useful operation.
You cannot compare two aggregates in C, either.

If you want to compare by reference, then compare their pointers.
If you want to compare by value, then compare their elements.

[This is undefined in C, precisely because everyone has a
different idea on what struct == struct might do. All bets are off
for struct <= struct, anyway.]