[EMAIL PROTECTED] writes:

> According to my study, "gcc" invoks  cc1plus under /usr/libexec/gcc/ ,
> and "g++" invokes cc1plus under /usr/libexec/gcc/.

'gcc' will invoke different compiler depending on the file extension,
and other command line arguments.

For example:

  echo "int main() { return 0; }" > junk.c && ln junk.c junk.cpp
  gcc -c junk.c        # invokes 'cc1'
  gcc -c junk.cpp      # invokes 'cc1plus'
  gcc -c -xc junk.cpp  # 'cc1'
  gcc -c -xc++ junk.c  # 'cc1plus'

The exact location where 'cc1' etc. come from also depends on how
gcc was configured, and command line flags, such as -B.

Finally, at link time 'g++' links libstdc++, and 'gcc' doesn't.

> As C is a subset of C++, 

C is not a proper subset of C++: many programs that are valid C
are not valid C++, and vice versa.

Here is a trivial example:

$ echo "int main() { free(malloc(1)); return 0; }" > junk.c
$ gcc -c junk.c && echo ok
ok

$ g++ -c junk.c && echo ok
junk.c: In function `int main()':
junk.c:1: error: `malloc' undeclared (first use this function)
junk.c:1: error: (Each undeclared identifier is reported only once for each 
   function it appears in.)
junk.c:1: error: `free' undeclared (first use this function)

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to