Thread View: gnu.gcc.bug
2 messages
2 total messages
Started by Bhyrava Prasad
Wed, 20 Nov 1996 00:00
Possible gcc bugs?
Author: Bhyrava Prasad
Date: Wed, 20 Nov 1996 00:00
Date: Wed, 20 Nov 1996 00:00
30 lines
1289 bytes
1289 bytes
Hi ,
I am using gcc to cross complile for 68k on a Sun.
gcc --version says it is 2.7-96q1.
Due to some error in cut and paste , I had a piece of code
similar to
void foo()
{
void foo()
{
int i;
some_function(i);
printf("hello world\n");
}
}
And gcc compiled it just fine. Is this a bug? If not , what
is happening?
Also , due to another cut and paste , a newline got inserted in
a string constant and gcc did not complain , but took it as a
\n in the string at that point. This seems inconsistent with
Microsoft C. Example
#define WORLD "hello
world"
Thanks
- BP
Re: Possible gcc bugs?
Author: Philippe.PEREZ
Date: Thu, 21 Nov 1996 00:00
Date: Thu, 21 Nov 1996 00:00
47 lines
1659 bytes
1659 bytes
Bhyrava Prasad wrote:
>
> Hi ,
> I am using gcc to cross complile for 68k on a Sun.
> gcc --version says it is 2.7-96q1.
> Due to some error in cut and paste , I had a piece of code
> similar to
> void foo()
> {
> void foo()
> {
> int i;
>
> some_function(i);
> printf("hello world\n");
> }
> }
>
> And gcc compiled it just fine. Is this a bug? If not , what
> is happening?
No, it's not a bug. Your code is correct so why do you want gcc to
complain ?
Teh second declaration of foo hides the former one and becomes a local
function of the former function foo. There is nothing to say about that.
It's up to you to keep in mind when you call "foo()" what is the
function wich is known at the line you make the call.
It's the same thing when you make :
int i;
void foo()
{
int i;
i=1;
}
main
{
i=1
}
the second "i" hides the first one and becomes local to the function
foo.
Philippe.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads