Re: embedded questions!!!



On Fri, 13 Jan 2006 15:09:26 -0600, Dave Hansen <iddw@xxxxxxxxxxx>
wrote:

>My copy of the standard is in a box somewhere, but H&S5, p33, about
>3/4 way down the page, says (asterisks indicate *bold* text):
>
> "*Storage for string constants.* You should never attempt to
> modify the memory that holds the characters of a string constant
> since that memory may be read-only -- that is, physically
> protected from modification."
>
>IIRC, the type of string literals is "array of (non-const, plain)
>char," but writing to them results in undefined (rather than
>implementation-defined) behavior. You might check with the denizens
>of comp.std.c to be sure...

I think that settles it. Thanks, Dave. And it makes sense, too.
Which is a good thing.

Jon
.



Relevant Pages

  • Re: FoxPro Database Memo Field
    ... Are you trying to insert a string constant longer than 254 characters or is ... >I am trying to insert a record into a FoxPro database using VB.net. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: character*80 versus character*1 (80)
    ... If you are stepping through the characters one-at-a-time, ... Assignment of a string constant will favor the string rather than the array. ...
    (comp.lang.fortran)
  • Re: why is this variable read-only
    ... of one such array object, so you're not allowed to modify it. ... the string constant is modified and life ... For an implementation that stores string constants in read- ...
    (comp.lang.c)
  • Re: why is this variable read-only
    ... of one such array object, so you're not allowed to modify it. ... I checked FAQ 1.32 (which says "may be stored in read-only memory") ... the string constant is modified and ... For an implementation that stores string constants in ...
    (comp.lang.c)
  • Re: C and string pointers
    ... Consider the first program: ... <snip old stuff> ... > which you aren't allowed to modify. ... How come I can redefine the value of the string constant? ...
    (alt.comp.lang.learn.c-cpp)