[pacman-dev] pm_transflag enum

Aaron Griffin aaronmgriffin at gmail.com
Thu May 8 14:06:16 EDT 2008


On Thu, May 8, 2008 at 12:39 PM, Dario Freddi <drf54321 at gmail.com> wrote:
> Hello,
>  I know this might look as a stupid question, though I can't manage to
>  use multiple flags, just as pacman does. This bunch of code:
>
>  pmtransflag_t flgs = PM_TRANS_FLAG_NOSCRIPTLET;
>
>  flgs |= PM_TRANS_FLAG_FORCE;
>
>  Simply doesn't compile, returning:
>
>  /home/drf/Development/shaman/trunk/shaman/src/AlpmHandler.cpp:
>  In member function 'bool
>  AlpmHandler::initTransaction(pmtranstype_t, pmtransflag_t, bool)':
>  /home/drf/Development/shaman/trunk/shaman/src/AlpmHandler.cpp:155:
>  error: invalid conversion from 'int' to 'pmtransflag_t'
>
>  Though, pacman just does it this way, so I can't get where I am
>  wrong. Any help would be appreciated.

Looks like that's C++ yelling at you. You'll need to throw casts at
it, but I'm not sure where. Try:

pmtransflag_t flgs = PM_TRANS_FLAG_NOSCRIPTLET;
flgs |= (pmtransflag_t)PM_TRANS_FLAG_FORCE;

or, alternatively, define a global operator |=(pmtransflag_t, int)




More information about the pacman-dev mailing list