public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* statements following strcpy cause parse error
@ 2002-02-07 15:41 Grant Gossett
  2002-02-07 16:01 ` bjorn rohde jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Gossett @ 2002-02-07 15:41 UTC (permalink / raw)
  To: gcc-help

Can anyone tell me if I am overlooking something here?


I have 2 programs here, one which compiles in gcc 2.96 and 3.03 and the
other which gives a parse error "before the last declaration of a char
array".

prog #1 which compiles fine:

#include <string.h>
int main()
{
     char filename[256];
     strcpy (filename, "/etc/bogus.conf\0");
     return 0;
}


prog # 2 which throws a parse error before 'char'  (meaning the strcpy
line??)

#include <string.h>
int main()
{
     char filename[256];
     strcpy (filename, "/etc/bogus.conf\0");
     char unused[256];
     return 0;
}

Am I missing something very obvious here? I've tried the above 2 programs
with 2 different distributiuons of linux (suse 7.2, redhat 7.2), 2
different versions of gcc (2.96 and 3.03) and the verision of glibc shipped
with RH 7.2 as well as the newest glibc available for download. I should
also mention I tried this with Visual C++ 6.0 and also the second wouldn't
compile but it gives a " missing ; before 'type' "error. This most likely
isn't just related to gcc, but I can't for the life of me figure out what
stupidity I am perpetrating here. I also should note that a declaration
such as "int bob = 0" instead of char unused also causes the same issue.

TIA
Grant


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-02-08  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18D3F27F5@whale.softwire.co.uk>
2002-02-08  1:28 ` statements following strcpy cause parse error Rupert Wood
2002-02-07 15:41 Grant Gossett
2002-02-07 16:01 ` bjorn rohde jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).