Article View: gnu.gcc.bug
Article #6005Re: gcc 2.7.2 problem with strtok()
From: M.Wang
Date: Fri, 27 Dec 1996 00:00
Date: Fri, 27 Dec 1996 00:00
24 lines
1082 bytes
1082 bytes
Alain Magloire <alainm@macs.ee.mcgill.ca> wrote:
: strtok("a b c", " ");
>"a b c" is a __string constant__ i.e non-writable
>strtok() will modify it hence the coredump
>try
>char string[10] = "a b c";
>strtok(string, " ");
I tend to agree what you said and what you suggested indeed solved
the problem. I just want to point put the SUN's c compiler does not
have problem with
strtok("a b c", " ");
OR
char *p;
p="a b c";
strtok(p, " ");
But gcc does generate coredump. Why is this? Thanks.
Technical Details
Message-ID:
<5a0vsc$ap0@nntpb.cb.lucent.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<59vbmi$9i0@nntpb.cb.lucent.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,18b9f2c0ce00f3 X-Google-Attributes: gid113d02,public From: xiaofei@lucent.com (M.Wang) Subject: Re: gcc 2.7.2 problem with strtok() Date: 1996/12/27 Message-ID: <5a0vsc$ap0@nntpb.cb.lucent.com> X-Deja-AN: 206241722 sender: bug-gcc-request@prep.ai.mit.edu references: <59vbmi$9i0@nntpb.cb.lucent.com> organization: AT&T original-from: mwang@fuwutai.wh.lucent.com (M.Wang) x-gateway: relay3.UU.NET from bug-gcc to gnu.gcc.bug; Fri, 27 Dec 1996 12:10:07 EST newsgroups: gnu.gcc.bug