Message-ID: <41FBBB1B17AFD4119ECE000347088836F5A916@wbnsmail.gtl.com> From: Rodney Leadbeater To: "'djgpp-workers AT delorie DOT com'" Subject: Array declarations allow non-constant expressions for dimensionin g Date: Thu, 28 Jun 2001 10:25:30 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Reply-To: djgpp-workers AT delorie DOT com Hi Why does gcc allow the following? I was amazed that it allowed the following. Very dangerous!!! #include int i = 20 ; int j ; int main (int argc, char **argv) { int a_i [i] ; // should not be allowed because of the danger (traditionally use ma lloc!) int a_j [j] ; // very dangerous printf ("sizeof a_i = %d\n", sizeof (a_i)) ; printf ("sizeof a_j = %d\n", sizeof (a_j)) ; return 0 ; } -- NOTICE: The information contained in this electronic mail transmission is intended by Convergys Corporation for the use of the named individual or entity to which it is directed and may contain information that is privileged or otherwise confidential. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email or by telephone (collect), so that the sender's address records can be corrected.