[Quickfix-developers] About getValue() and getString() field methods
Brought to you by:
orenmnero
From: Guillermo A. A. <gar...@vi...> - 2005-01-11 11:42:24
|
Hi, i dont really know if this is a known issue of C++ / Stl, but i found =0D an strange behavior when using this methods in my appiclation. I'll try to explain it: I have a bunch of functions that fills message's string-type fields (StringBase), then, to check if the field had actually been filled, i =0D did: if(field.getValue().lenght()) =09AddField(field, msg); (which is mainly msg.set(field)) But i found that field.getValue().lenght() gave me always npos (ie. 134552524). In fact, if i try to call any non-static method directly =0D from field.getValue() i get a segfault. That makes me think that the =0D std::string returned by getValue() has not yet been created, or there is a fault in getValue() method (verly unlikely, because if i do std::string s =3D field.getValue(), s.lenght() is ok). I found that using getString() method instead works fine, as it =0D returns a reference to the string, and its even better to use, due to performance issues, if you just want to check fields length. So my question is: its a know issue (or even a feature) on C++ that u =0D cant call methods on an object returned by value directly after the function =0D is called (i.e. without having a variable to hold it), or its an STL/C++ =0D fault? Thanks to all, everyday i found quickfix more useful! P.S: =09I'm using gcc-3.2.3-49, without STLPort, and with MySQL on RedHat ES3 (IntelP4). Guillermo =0D =0D ****************************** AVISO LEGAL =0D ****************************** La informaci=C3=B3n contenida en este mensaje es para uso exclusivo de su= =0D destinatario. No debe copiarse, transmitirse a terceros ni guardarse por = =0D estos =C3=BAltimos, salvo autorizaci=C3=B3n del remitente. Puede contener informaci=C3=B3n confidencial o legalmente protegida cuyo = =0D r=C3=A9gimen legal de utilizaci=C3=B3n no se ve afectado por el hecho de = que =0D haya sido enviada por correo electr=C3=B3nico. Su env=C3=ADo por error a una persona distinta de su destinatario real no= =0D implica que se haya modificado tal destinatario ni supone renuncia a su =0D eventual car=C3=A1cter confidencial o al r=C3=A9gimen legal que rija su =0D utilizaci=C3=B3n. Cualquier opini=C3=B3n expresada en este mensaje vincular=C3=A1 exclusiva= mente a =0D la persona que lo haya remitido, excepto cuando el mensaje establezca lo = =0D contrario y el remitente est=C3=A9 autorizado para establecer que dichas = =0D opiniones vincular=C3=A1n a esta entidad.=20 En el supuesto de que este correo se recibiera por error, rogamos =0D procedan a borrarlo, sin reenviarlo a terceros ni conservarlo en =0D cualquier soporte y nos informen inmediatamente llamando al tel=C3=A9fono= 34 =0D 91 5892123 o a la direcci=C3=B3n de correo electr=C3=B3nico remitente. Gr= acias. ****************************** DISCLAIMER ****************************** The information contained in this message is for the exclusive use of =0D the named person. It can not be copied, transmitted to third parties or =0D stored by the latter, except if authorised by the sender. It may contain confidential or legally privileged information whose =0D legal regime is not affected by the fact that this information has been =0D sent by e-mail.=20 Its erroneous transmission to a person other than the real named person =0D neither implies any modification of this named person nor a renunciation = =0D of the eventual confidentiality or legal regime affecting the use of =0D concerned message. =20 Any views expressed in this message are binding exclusively upon the =0D individual sender, except where the message states otherwise and the =0D sender is authorised to bind this entity.=20 If you receive this message in error, please delete it without =0D transmitting it to any third party or keeping it in any form and notify =0D us immediately either by phone (34 91 5892123) or using the e- mail =0D address of the sender. Thank You.=0D |