LWN.net Logo

Russell: GCC and C vs C++ Speed, Measured

Russell: GCC and C vs C++ Speed, Measured

Posted Mar 26, 2013 10:48 UTC (Tue) by khim (subscriber, #9252)
In reply to: Russell: GCC and C vs C++ Speed, Measured by aleXXX
Parent article: Russell: GCC and C vs C++ Speed, Measured

I mean, even if I do "g++ main.c", main.c is still considered a C file and sizeof('a') should still be 1.

Rilly? It's easy to test, you know.

$ cat main.c
#include <stdio.h>

int main() {
  printf("%zd\n", sizeof 'a');
  return 0;
}
$ gcc main.c -o main ; ./main
4
$ g++ main.c -o main ; ./main
1


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds