Re: strlen within Classes (macro)

Fons Rademakers (Fons.Rademakers@cern.ch)
Thu, 15 May 1997 19:11:20 +0200


Hi Otto,

this seems to be a CINT problem. For a workaround change:

int l = strlen(s);

to

int l;
l = strlen(s);

Cheers, Fons.

PS: Masa could you have a look at this.

Otto Schaile wrote:
>
> Dear roots,
> whats wrong with the following macro, I get segmentation violation from
> strlen. If I use this function in a macro without a class it works:
>
> #include <iostream.h>
> #include <string.h>
>
> class Simple{
> public:
> Simple();
> char *string;
> }
> Simple::Simple()
> {
> char *s="xxxxx";
> cout << s << endl;
> int l=strlen(s);
> cout << l << endl;
> }
>
> Cheers,
>
> ----------------------------------------------------------------------------
> Otto Schaile Sektion Physik der LMU Muenchen
> Phone: (+49 89)289 14070 Am Coulombwall 1, D-85748 Garching, Germany
> FAX: (+49 89)289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910