This topic is now archived and is closed to further replies.


-=<C vs. C++>=-

Recommended Posts

Nah you shouldn''t have to change your code. If you''re linking .c files to .cpp files you might have problems with the way the compiler mangles function names internally.

Doing a web search for extern "C" will help you if you run into this.

Oh, and ads in posts? Isn''t that "a bit" lame?

Share this post

Link to post
Share on other sites
Hmm, if you''re using non-ANSI features of C, like function prototypes without parameters, or the ''parameters of a function definition in a declaration block'' thing, then C++ will choke on that. C++ will also be more strict about implicit casting and undeclared functions.

int foo ();
int foo (x, y, z)
int x, y, z;
printf("hello, world");

That is valid in non-ANSI C, but invalid in C++. If you''re using ANSI C, however, you might not notice that much difference. One thing of note is that you can''t have a struct with the same name as a typedef, for example. That''s not really an issue, because you shouldn''t be doing that anyway.

All your bases belong to us

Share this post

Link to post
Share on other sites