Wireshark mailing list archives

Re: SET_ADDRESS, if-else


From: Evan Huus <eapache () gmail com>
Date: Sat, 7 Sep 2013 08:53:15 -0400

On Sat, Sep 7, 2013 at 6:16 AM, Martin Kaiser <lists () kaiser cx> wrote:

Hi,

I just found that

if (...)
   SET_ADDRESS(...);
else
   SET_ADDRESS(...);

does not compile as this would expand to

if (...)
{
};
else
{
}

and the compiler complains about else without if.

Is there anything useful we could do about this other that putting
another pair of brackets around the first SET_ADDRESS?


The usual trick in this situation is to wrap the macro in a "do { MY CODE }
while (0)" so that it behaves syntactically like a normal function call. I
have done this in r51819, so it should work now.

Cheers,
Evan
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: