From: tenbux AT hotmail DOT com (tenbux) Newsgroups: comp.os.msdos.djgpp Subject: compiler doesn't catch missing semicolon after struct Date: 9 Oct 2001 13:27:56 -0700 Organization: http://groups.google.com/ Lines: 46 Message-ID: NNTP-Posting-Host: 143.109.32.240 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1002659276 22666 127.0.0.1 (9 Oct 2001 20:27:56 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: 9 Oct 2001 20:27:56 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi all, I was working on a fairly simple lab for a CS class, and using DJGPP to compile and test my programs. Here is some sample code I had written: #include struct bit { int bit; struct bit *next; } main(int argc, char *argv[]) { int x; FILE *in, *out; if (argc < 3) { puts("Usage: binprint "); return; } if ((in = fopen(argv[1], "r")) == NULL) { printf("Error opening input file: %s\n", argv[1]); return; } You'll notice that there is no semicolon after the struct declaration (as is required). But gcc didn't catch this, instead it warned me about main not being declared as int. So when I ran the binary with no arguments, it skipped the argc check and gave me this message: Error opening input file: TEMP=C:\WINDOWS\TEMP Not quite right... so I put some test code in, and discovered argc had a value of 13268 and any strings I attempted to print out magically turned into environment variables! After I realized that the semicolon was missing and put it in, it fixed the problems, but obviously the compiler needs to catch that. Is this a current bug or is it supposed to act that way? :) -- Buddy