[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segmantation fault
From: |
jesus |
Subject: |
Re: Segmantation fault |
Date: |
Mon, 26 Mar 2001 09:02:11 -0500 (EST) |
Why don't you try with:
[a-zA-Z-]+[0-9]* {
yylval.name = strdup(yytext);
return IDENTIFIER;
}
I think it is cleaner and it work to me ;)
> hi !
>
> I am making a parser using lex and yacc..not flex and bison..so sorry
> for posting the message on this group.
>
> Am working on Solaris 2.6/5.6 on Sun PC !
>
> I get a segmentation fault when i try 2 allocate some memory..here is
> the sample code..
>
> [a-zA-Z-]+[0-9]* {
>
> yylval.name = (char *)malloc(strlen(yytext) + 1);
> strcpy(yylval.name, yytext);
> return IDENTIFIER;
>
> }
>
> This works fine for the first time and gives a segmentation fault the
> second time !!
>
> My yylval is
>
> %union {
>
> char *name;
> int intval;
> double realval;
> }
>
> So any ideas ??
>
> Thanx for the help !
>
>
--
--
Jesus Miguel Diaz Hdez
__________________________________
Grupo de Redes
Facultad de Matrmatica Cibernetica
Universidad de la Habana, Cuba
e-mail:
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Segmantation fault,
jesus <=