home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / sgi / 19059 < prev    next >
Encoding:
Text File  |  1993-01-23  |  1.2 KB  |  42 lines

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!cs.ubc.ca!larry.cs.ubc.ca!not-for-mail
  2. From: samuel@cs.ubc.ca (Stephen Samuel)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: Does an Indigo make read-only text segments?
  5. Date: 22 Jan 1993 17:02:50 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Lines: 30
  8. Message-ID: <1jq5fqINN3hf@larry.cs.ubc.ca>
  9. References: <35088@adm.brl.mil>
  10. NNTP-Posting-Host: larry.cs.ubc.ca
  11.  
  12. gml4410@ggr.co.uk (Lack Mr G M) writes:
  13.  
  14. >Replying to:
  15. >   Frank Perdicaro <frank@marvin.contex.com>
  16.  
  17. >     NO.   There  are  2  things  here.   If you declare something to be
  18. >"const" then the compiler should  complain  at  *compile*  time  if  you
  19. >attempt   to   modify   it.    It  is  *NOT*  writeable.   However,  the
  20.  
  21. Isn't always doable.. 
  22.  
  23. .... 
  24. char *astring="a constant string";
  25. ...
  26. playwith(astring);
  27. ....
  28.  
  29. playwith(char * somestring; ){
  30. ...
  31.     strcpy(somestring,"something else");
  32. ...
  33. }
  34.  
  35. This gets especially difficult if the call and function are in different
  36. files.  Granted, we could define type rules that make this impossible, 
  37. but then... It might not be C anymore...
  38. -- 
  39. -- 
  40. Stephen Samuel         (604)822-9248        samuel@cs.ubc.ca
  41. The first prerequisite to winning is playing the game.
  42.