Not logged in
Log in now
Create an account
Subscribe to LWN
Recent Features
LWN.net Weekly Edition for April 4, 2013
LWN.net Weekly Edition for March 28, 2013
A kernel change breaks GlusterFS
PyCon: Evangelizing Python
Multipath TCP: an overview
I mean, even if I do "g++ main.c", main.c is still considered a C file and sizeof('a') should still be 1. Or does that forcce cxx as a language on all C files ?
Alex
Russell: GCC and C vs C++ Speed, Measured
Posted Mar 24, 2013 12:46 UTC (Sun) by jwakely (subscriber, #60262) [Link]
Approximately, it does CC=g++
> I mean, even if I do "g++ main.c", main.c is still considered a C file and sizeof('a') should still be 1.
I assume you mean sizeof('a') should be 4 if it was considered a C file, but it isn't, using g++ implies the input file is C++
Posted Mar 26, 2013 10:48 UTC (Tue) by khim (subscriber, #9252) [Link]
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
Copyright © 2013, Eklektix, Inc. Comments and public postings are copyrighted by their creators. Linux is a registered trademark of Linus Torvalds