C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

error not caught at link time: should it be?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
nzanella@cs.mun.ca
Guest





PostPosted: Wed Jul 27, 2005 6:35 pm    Post subject: error not caught at link time: should it be? Reply with quote



Hello,

I have two .cpp files. The first one contains:

Foo *foo;

and in the second one contains:

Foo foo;

I am using a modified version of gcc
with Makefiles automatically created.
The strange thing is that the tools
go through the link phase without
detecting the error. Isn't it to
be expected that the error be
caught by the linker???

I feel somewhat surprised that
it didn't catch it. I guess
when the linker looks for
external symbols it doesn't
care about matching their
types (eg. pointer versus value).

Thanks!!!

Neil

Back to top
Ken Wilson
Guest





PostPosted: Wed Jul 27, 2005 7:03 pm    Post subject: Re: error not caught at link time: should it be? Reply with quote



On 27 Jul 2005 11:35:48 -0700, [email]nzanella (AT) cs (DOT) mun.ca[/email] did courageously
avow:

Quote:
Hello,

I have two .cpp files. The first one contains:

Foo *foo;

and in the second one contains:

Foo foo;

I am using a modified version of gcc
with Makefiles automatically created.
The strange thing is that the tools
go through the link phase without
detecting the error. Isn't it to
be expected that the error be
caught by the linker???

I feel somewhat surprised that
it didn't catch it. I guess
when the linker looks for
external symbols it doesn't
care about matching their
types (eg. pointer versus value).

Thanks!!!

Neil

I think we need to see more of the actual code. There is the
possibility that you don't get an error because there isn't one as
neither variable resides in the other's scope. You also need to be
aware that C++ will let you 'hide' variables, contrary to behaviour
you would see in a more strictly typed language, i.e. Java, C#, etc.

Ken Wilson
"Coding, coding, over the bounding main()"

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.