0

I'm switching from old gcc(3.x) to 4.9.2 and I have some compile issue:

if (ROWID_IS_NULL(&pSumItem->getRowId()))

getRowId() is defined as:

rowid_t SumItem::getRowId()
{
    return row_id;
}

macro is defined as:

#define ROWID_IS_NULL(a) \
    ((a)->key == 0 && (a)->ip_addr == 0)  

The new code already uses operator overloading to do the calculation, but there still remains a lot of the old code using the non-standard technique. Is it possible to fix this problem without changing the codes?

Error message:

error: taking address of temporary [-fpermissive]

Edit : meaning of do not changing the codes

I want to keep this line work

if (ROWID_IS_NULL(&pSumItem->getRowId()))
2
  • 1
    Well, as the error suggests (although I wouldn't blame you for not interpreting it that way), -fpermissive, but it's not the greatest option for code safety. Commented Apr 20, 2015 at 3:51
  • @chris thanks, but I do not want to use that flag Commented Apr 20, 2015 at 4:03

1 Answer 1

3

I don't know how far you want to take the "without changing the codes" part. Clearly, whatever fix is applied changes them in some way.

This would be the simple fix, methinks:

static inline bool ROWID_IS_NULL(const rowid_t &id) {
    return(id.key == 0 && id.ip_addr == 0);
}

Admittedly, though, that would require you to remove the explicit & operator in the calls to ROWID_IS_NULL.

Sign up to request clarification or add additional context in comments.

2 Comments

In other words, it is not possible to fix this issue safely without changing the codes?
Again, what do you mean by "without changing the codes"? Clearly, you can't fix it without changing something, at least, no?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.