🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50526

modifying string constants

#50526
From: Jason Rosenberg
Date: Tue, 21 Sep 1993 02:12
23 lines
1528 bytes
Hello,

I'm in the process of converting some code that runs
under cc to gcc.  I have discovered one thing that will
run fine in cc, but causes a segmentation violation for
gcc.  That is, if I pass in a string constant to function which
declares the argument as a pointer to char, the program crashes
the moment I try to modify the contents of the string.  Now,
it seems like this should be an error, but cc allows this, no
problem. 

My question, is this discrepancy due just to the fact that cc
and gcc are implemented differently, and cc maintains its string
constants in different place that gcc?  Or is it an ANSI requirement
that this situation be an error....

Jason


-- 
Jason Rosenberg                           Computer Science Department
jason@cs.ucla.edu                         University of California
{uunet,rutgers,ucbvax}!ucla-cs!jason      Los Angeles, CA  90024
Technical Details
Message-ID: <1993Sep21.021222.13540@cs.ucla.edu>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!ucla-cs!lanai.cs.ucla.edu!jason

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,8faf186c317d18e0,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-09-20 21:54:08 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!ucla-cs!lanai.cs.ucla.edu!jason
From: jason@lanai.cs.ucla.edu (Jason Rosenberg)
Subject: modifying string constants
Message-ID: <1993Sep21.021222.13540@cs.ucla.edu>
Sender: usenet@cs.ucla.edu (Mr Usenet)
Nntp-Posting-Host: lanai.cs.ucla.edu
Organization: UCLA, Computer Science Department
Date: Tue, 21 Sep 93 02:12:22 GMT
Lines: 23