K
Kenneth Brody
arnuld said:This is the question that I need some explanation to understand it:
Some features of C which keep it from being a strict subset of C++ (that
is, which keep C programs from necessarily being acceptable to C++
compilers) are that main may be called recursively, character constants
are of type int, prototypes are not required, and void * implicitly
converts to other pointer types.
anyone has an example ?
#include <stdio.h>
int main(int argc,char **argv)
{
printf("%d '%s'\n",argc,(*argv)?(*argv):"<null>");
if ( argc > 0 )
return main(argc-1,argv+1);
return 0;
}
However, my C++ compiler also compiles the above, without any warnings,
even on highest warning level.
I learned C++ 1st. This fact was strange for me.
Okay.
you mean decelerations (e.g of variables and arrays) ? They are also not
required in C++.
No, it says "prototypes".
This is valid C:
int foo()
{
return bar(7,8);
}
int bar(int a,int b)
{
return a+b;
}
My C++ compiler gives an error on the call to bar().
This was the question already ran in a separate thread started by me and I
got nice answers from the regular posters
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>