This is the mail archive of the
mailing list for the Cygwin project.
Re: Cygwin Memory Handling in Arrays
- To: "Ward Correll" <email@example.com>
- Subject: Re: Cygwin Memory Handling in Arrays
- From: Mumit Khan <firstname.lastname@example.org.EDU>
- Date: Sun, 25 Jul 1999 16:24:42 -0500
- cc: email@example.com
"Ward Correll" <firstname.lastname@example.org> writes:
> How does Cygwin manage memory in this c++ program?
> I thought that either the arrays sentinelOne or sentinelTwowould have
> been over written containing the value from writting past the end of the
> array TargetArray. What happened here?
You thought wrong. Your code is invokes undefined behaviour in C and C++
(writing outside of array bounds), and an implementation is free to do
whatever it chooses.
The answer to your question lies in how the stack variables are aligned,
and you can get an insight by changing the index from 26 to say 28 and
see what happens.
Want to unsubscribe from this list?
Send a message to email@example.com