[Bro-Dev] Rethinking Broker's blocking API

Matthias Vallentin vallentin at icir.org
Tue Jan 10 07:39:47 PST 2017


> > To distinguish between the two status, I use operator bool.
> 
> I don't see that in the "status and error handling" section. Would I
> do "if (! status) { <error stuff> }"? That doesn't seem quite
> intuitive. I think a method with a descriptive name would be better
> here.

Sorry, that was misleading. Statuses don't provide an operator bool.
They could, however, to distinguish them from errors.

> >     if (auto data = msg.data())
> >       f(*data)
> >     else
> >       g(*msg.status())
> 
> For this I think I prefer the boolean version: "if (msg) { <use
> msg.data() })".

Okay, I'll switch that over. I prefer the other way, though :-).

    Matthias


More information about the bro-dev mailing list