Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <199907252124.QAA19727@mercury.xraylith.wisc.edu> To: "Ward Correll" cc: cygwin AT sourceware DOT cygnus DOT com Subject: Re: Cygwin Memory Handling in Arrays In-Reply-To: Your message of "Sun, 25 Jul 1999 17:43:15 EDT." <19990725214317 DOT 29753 DOT qmail AT hotmail DOT com> Date: Sun, 25 Jul 1999 16:24:42 -0500 From: Mumit Khan "Ward Correll" writes: > How does Cygwin manage memory in this c++ program? > I thought that either the arrays sentinelOne[3] or sentinelTwo[3]would have > been over written containing the value from writting past the end of the > array TargetArray[25]. 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. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com