Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: previous de...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 13 Topic 26030 of 27670
Post > Topic >>

Re: previous declaration of Table was here / conflicting types for

by Flash Gordon <spam@[EMAIL PROTECTED] > May 7, 2008 at 07:14 PM

Michael.Z wrote, On 07/05/08 09:05:
> On May 6, 1:21 am, Nick Keighley <nick_keighley_nos...@[EMAIL PROTECTED]
>
> wrote:

<snip>

> Regarding to your post:
>> so he had two different types didn't he?
> 
> He did have two different types. Its "void *" in header file while
> "struct List *" in List.c;
> eg.
> /*List.h*/
> typedef void *List;
> 
> /*List.c*/
> typedef struct List{....} *List;

In that case what he provided was wrong. No ifs, not buts, it is just 
plain wrong. Wrong as in the definition of the language says that it is 
wrong.

> However there was no conflicting type error,

The error is still there, it is just hidden from the compiler so that it 
does not tell you about it. It is no more correct than driver the wrong 
way up a one way street at 100mph is legal if you do not get caught. Not 
being caught does not make it legal.

> the reason is he did not
> include file "List.h" in his "List.c".

That, whilst not forbidden by the language, is generally considered to 
be bad practice. The reason it is considered to be bad practice is 
specifically *because* it hides errors like this.

> So I removed #include "Table.h" from my "Table.c", it complied well.

Compiling does not make it correct. If you have a good relation****p with 
your tutor/lecturer/teacher you should explain to your lecturer that his 
code is wrong. If your relation****p is not good enough to get away with 
that you should ask him why it fails to compile if the header file is 
not included (but avoid arguing the point if it will affect your 
grades). In either case, you should take any code presented with at 
least a pinch of salt, and if he does not understand the problem you 
should take the entire course with a whole keg of salt as what you are 
being taught is wrong.
-- 
Flash Gordon
 




 13 Posts in Topic:
previous declaration of Table was here / conflicting types for
"Michael.Z" <  2008-05-03 00:22:21 
Re: previous declaration of Table was here / conflicting types
ade ishs <no-spam@[EMA  2008-05-03 19:34:39 
Re: previous declaration of Table was here / conflicting types
Flash Gordon <spam@[EM  2008-05-03 10:32:51 
Re: previous declaration of Table was here / conflicting types f
"Michael.Z" <  2008-05-05 19:33:26 
Re: previous declaration of Table was here / conflicting types f
Nick Keighley <nick_ke  2008-05-06 02:21:25 
Re: previous declaration of Table was here / conflicting types f
Ben Bacarisse <ben.use  2008-05-06 12:32:13 
Re: previous declaration of Table was here / conflicting types f
"Michael.Z" <  2008-05-07 01:05:08 
Re: previous declaration of Table was here / conflicting types f
Flash Gordon <spam@[EM  2008-05-07 19:14:36 
Re: previous declaration of Table was here / conflicting types f
CBFalconer <cbfalconer  2008-05-07 12:01:43 
Re: previous declaration of Table was here / conflicting types f
"Michael.Zhang"  2008-05-09 02:40:34 
Re: previous declaration of Table was here / conflicting types f
Chris Torek <nospam@[E  2008-05-10 05:43:46 
Re: previous declaration of Table was here / conflicting types f
Ben Bacarisse <ben.use  2008-05-10 01:19:38 
Re: previous declaration of Table was here / conflicting types f
"Michael.Zhang"  2008-05-10 20:11:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 22:09:27 CDT 2008.