Skip to content

Callback: comparision fails #5017

Closed
@0xc0170

Description

@0xc0170

Description

  • Type: Bug
  • Priority: Major

How to reproduce:

#include "mbed.h"
#include "rtos.h"

void donothing()
{

}

int main()
{
    Callback<void()> func1;
    Callback<void()> func2;
    func1 = donothing;
    func2 = donothing;
    if (func1 != func2) {
        error("Should be equal");
    }
}

I had similar code in one patch that started failing. I was looking for API in Callback that would check if Callback was assigned the same function (the default one), the only way there I found was to use comparision operators. Those however fail, as shown above.

What I noticed that when those two objects are compared, _obj is always different. Seems to me that generate() method does not generate properly callback - does not pollute all members?

@geky @pan-

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions