Thanks Nico.

>> ...but could be told using a compiler switch to place them in the data 
>> segment instead...

And then, using this flag, the original code would not crash...

Thanks,
Kayo.

----- Original Message ----
From: Nico Heinze <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, April 11, 2007 3:50:39 PM
Subject: [c-prog] Re: Segmentation fault in a simple function.

--- In [email protected], Kayo Hisatomi <[EMAIL PROTECTED]> wrote:
>
> Hi Nico,
> 
> >> As far as I know this is not necessarily correct.
> >> It might well happen that the string "  bye 1  " is
> >> stored in a read-only part of memory during process
> >> initialisation.
> 
> I thought on this too, but I could not think in another
> area than the .text section...
> 
> This is a good question: are the static strings
> allocated in the .text area?
<snip>

Kayo,

this question might be impossible to answer. The point is that the
"text area" is a term specific to Unix; it might not exist in other
environments.
I admit, however, that personally I don't know any environment which
doesn't utilise a text area for executable code, but they might exist;
perhaps some embedded systems.
Anyway, what I want to point out is that the term "text area" is
specific to one kind of operating system. It might or might not exist
on other platforms.

And even on those platforms which do have a text area this is not
always handled in the same way. I dimly recall that many years ago
I've read a test about C compilers for MS-DOS; one compiler usually
placed fixed strings in the text area but could be told using a
compiler switch to place them in the data segment instead. Such
behaviour is valid according to ANSI C.

Regards,
Nico



To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links








       
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/


To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/c-prog/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/c-prog/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to