FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 05-08-2008, 05:39 PM
Dario Freddi
 
Default pm_transflag enum

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.

Cheers
Dario

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-08-2008, 06:06 PM
"Aaron Griffin"
 
Default pm_transflag enum

On Thu, May 8, 2008 at 12:39 PM, Dario Freddi <drf54321@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)

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-09-2008, 12:21 PM
Dario Freddi
 
Default pm_transflag enum

Thanks Aaron,
Casts were the right thing to do, though this is the right way to cast (the
only one I found that actually works):

flags = (pmtransflag_t) ((pmtransflag_t)flags |
(pmtransflag_t)PM_TRANS_FLAG_FORCE);

Thanks for your help!
Cheers
Dario

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 05:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org