Stefan, I would like to do on the Python side:
t = faceparser.FaceObject() if (t.gender = None): print 'gender is not defined' else: print gender Best regards, Luiz Vitor. On Tue, Oct 2, 2012 at 1:44 PM, Luiz Vitor Martinez Cardoso < grab...@gmail.com> wrote: > Stefan, > > Thank you! > > To clarify my explanation... the pointer declarations are members from a > class called FaceObject. > > qint32 * gender; > float * age; > float * ageDeviationDen; > quint32 * happy; > quint32 * sad; > quint32 * surprised; > quint32 * angry; > > Depending on the software flow these pointers may or may not be > initialized. > > The problem occurs when the pointers are not initialized (poiting to NULL) > and I try to read their value inside Python. > > # faceobject_poc.py > > t = faceparser.FaceObject() > t.mergeCount <= It's okay! > t.gender <= I got an Seg. Fault... because qint32 * gender = NULL > > > I of course could try a qint32 * gender = new quint32()... but do you know > any way to handle the non-intialized members? > > Thank you! > > > On Tue, Oct 2, 2012 at 1:35 PM, Stefan Seefeld <ste...@seefeld.name>wrote: > >> On 10/02/2012 12:29 PM, Luiz Vitor Martinez Cardoso wrote: >> > >> > All the members are initialized to 0 or NULL if it's a pointer. >> > >> > The problem is that I'm getting a "Segmentation Fault" message when I >> > try to access the pointers members from Python. >> >> Can you elaborate on what you want to happen in that case ? Python has >> no notion of pointers, so the pointers would need to be dereferenced. If >> that isn't what you want, you need to add some logic to return something >> else if the members are not initialized yet. >> >> Stefan >> >> >> -- >> >> ...ich hab' noch einen Koffer in Berlin... >> >> _______________________________________________ >> Cplusplus-sig mailing list >> Cplusplus-sig@python.org >> http://mail.python.org/mailman/listinfo/cplusplus-sig >> > > > > -- > Regards, > > Luiz Vitor Martinez Cardoso > Celular: (11) 7351-7097 | Skype: grabberbr > engineer student at maua.br > <http://maua.br>intern marketing engineer at geindustrial.com.br > entrepreneur at adboxnetwork.com > > "If you wanna be successful, you need total dedication, go for your last > limit, give your best and love your love infinitely!" > > "The only limits are the ones you place upon yourself" > > -- Regards, Luiz Vitor Martinez Cardoso Celular: (11) 7351-7097 | Skype: grabberbr engineer student at maua.br <http://maua.br>intern marketing engineer at geindustrial.com.br entrepreneur at adboxnetwork.com "If you wanna be successful, you need total dedication, go for your last limit, give your best and love your love infinitely!" "The only limits are the ones you place upon yourself"
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig