why is this variable read-only

R

Richard Bos

John Bode said:
No. Invoking undefined behavior simply means you've done something
that the standard explicitly does not address

Erm, no. It may also mean something that the Standard does not
explicitly address, which is not the same thing. From 4.2:

# Undefined behavior is otherwise indicated ... or by the omission of
# any explicit definition of behavior. There is no difference in
# emphasis among these three; they all describe ‘‘behavior that is
# undefined’’.

Although in the specific case under discussion, it is indeed explicitly
not defined.

Richard
 
N

Nick Keighley

Thanks a lot for your answer.
I got it.
But I have another doubt i.e. If I execute that line (char*
a="Sme_big_string_literal";)in a while loop ,will I eventually fill up
the whole memory?

I'm not sure could you post a complete example?

int main (void)
{
while (1)
char *a = Some_big_string_literal";
return 0;
}

this will never terminate but it won't use any extra memory.
What did you mean?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top