Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm Sender: cygwin-owner@sourceware.cygnus.com Delivered-To: mailing list cygwin@sourceware.cygnus.com Message-Id: <199907252124.QAA19727@mercury.xraylith.wisc.edu> To: "Ward Correll" cc: cygwin@sourceware.cygnus.com Subject: Re: Cygwin Memory Handling in Arrays In-Reply-To: Your message of "Sun, 25 Jul 1999 17:43:15 EDT." <19990725214317.29753.qmail@hotmail.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@sourceware.cygnus.com