Skip to main content
38 events
when toggle format what by license comment
Sep 13, 2019 at 22:18 history protected gnat
Sep 13, 2019 at 8:26 answer added fiorentinoing timeline score: -1
Aug 16, 2016 at 10:56 review Close votes
Aug 21, 2016 at 3:03
Aug 16, 2016 at 10:38 comment added gnat Possible duplicate of Why are the sizes of programs so large?
Jul 7, 2014 at 5:16 review Close votes
Jul 8, 2014 at 12:12
Jul 4, 2014 at 2:26 comment added Petruza Actually streams are not a C++ language feature as many believe, they're just template classes with the bitshifting operators << and >> overloaded.
Jul 4, 2014 at 2:20 comment added Petruza It's not "the same hello world program", they are two different programs. You should compile the C program with a C++ compiler and see what happens. People tend to assume that for a program to be in C++ it has to use streams and not printf.
Jul 3, 2014 at 16:06 history edited user53019 CC BY-SA 3.0
tried to focus on the broader, conceptual aspects of "what is the compiler doing?"
Jul 3, 2014 at 3:01 review Close votes
Jul 3, 2014 at 16:06
Jul 2, 2014 at 7:57 vote accept Hawk
Jun 28, 2014 at 20:03 answer added DeadMG timeline score: 2
Jun 27, 2014 at 8:04 review Close votes
Jun 27, 2014 at 13:27
Jun 26, 2014 at 22:37 comment added user53141 Comparing "Hello World" programs is almost entirely meaningless as no one optimizes compilers for trivially small programs. It is very likely that your C++ compiler has flags that, if you switch to printf (available in C++) will produce a file of similar size to C (for example, -nostdlib and -nodefaultlibs.
Jun 26, 2014 at 21:25 answer added Nikko timeline score: 8
Jun 26, 2014 at 20:43 answer added Niall timeline score: 6
Jun 26, 2014 at 20:03 comment added rplantiko With Fabrice Bellard's "Tiny C compiler", the hello world program even needs only 2036 Bytes (type tcc hello.c in bellard.org/jslinux and inspect a.out in ls -ls
Jun 26, 2014 at 19:51 history tweeted twitter.com/#!/StackProgrammer/status/482249763254202368
Jun 26, 2014 at 19:41 comment added iheanyi Assuming he has no idea of compiler flags, etc, etc, the answer by glampert neatly explains the size difference.
Jun 26, 2014 at 19:09 answer added glampert timeline score: 24
Jun 26, 2014 at 18:30 comment added zxcdw There is no question here. Furthermore, even if there was, that question would be unanswerable without specific knowledge about compiler and compilation flags used. The only way to get a precise answer to a question why C++ executable would be so much bigger and what exactly takes up the bytes would be to use some kind of a binary analysis tool (e.g. readelf on Unix systems, part of GNU binutils) or a hex editor to investigate file sections and contents. What comes to languages themselves, there's absolutely no reason for a difference like that. C++ output could be just as small as C.
Jun 26, 2014 at 17:02 history edited user40980 CC BY-SA 3.0
'i' to 'I'. Single period ends sentence.
Jun 26, 2014 at 16:41 comment added Karl Bielefeldt What compiler are you using? I get 6.7K and 7.9K respectively, which is comparable to the question gnat linked. I'm thinking your compiler choice and/or settings are having a larger effect than the language in this case.
Jun 26, 2014 at 16:19 review First posts
Jun 26, 2014 at 17:02
Jun 26, 2014 at 16:16 comment added gnat question on what technology to take up next would be closed here
Jun 26, 2014 at 16:16 comment added Hawk @Panzercrisis, I don't code Assembly but since PHP is written in C, would C++ do almost the same as C if combined with PHP?
Jun 26, 2014 at 16:14 comment added Hawk got it @gnat, that was what I thought..needed confirmation..but I still remain a skeptic on whether to choose C or C++ considering that most languages are written in C.
Jun 26, 2014 at 16:14 comment added Panzercrisis @Hawk The fact that C++ has classes and all the other stuff associated with them is a large part of the reason that C is lower level and closer to the hardware. Still you can usually do the same things in C++ as you can in C. Since C is basically a subset of C++ - without a lot of the features in C++ - it takes longer to write big, huge programs, but it will run somewhat faster. As for interacting with other languages...do you mean like writing assembly language into the C++ code? Yeah, C++ supports that, but I'm not sure if C does or not.
Jun 26, 2014 at 16:12 comment added gnat as far as I can tell, this has been asked and answered at SO: Why is a C/C++ “Hello World” in the kilobytes? @RobertHarvey FWIW Java ME CLDC 1.0 footprint is per my recollection 128K, not too much even for end '90s embedded devices
Jun 26, 2014 at 16:11 comment added Hawk @Panzercrisis, is there a possibility of interaction with other languages like there is in C..??
Jun 26, 2014 at 16:09 comment added Panzercrisis @Hawk C++ is more powerful by a long shot (partially because C is almost completely contained in it). C++ is better for you to learn for general intents and purposes, though C is better for things like embedded devices.
Jun 26, 2014 at 16:08 comment added Hawk cos I've noticed people talking about C being lower level and more closer to hardware systems but C++ has classes whereas C doesn't..I am confused..
Jun 26, 2014 at 16:08 comment added Hawk so is it better if i learn C or C++?? i mean which is more powerful?
Jun 26, 2014 at 16:07 comment added Panzercrisis Also, it would be a fairer test if you were to write the same exact code in both languages. Even then, I'm not sure that would rid you of the difference, since C++ is much more complicated to compile (and thus would be done differently).
Jun 26, 2014 at 16:07 comment added Robert Harvey Sort of explains why C is used a lot on embedded devices.
Jun 26, 2014 at 16:05 comment added Hawk so should i delete the question and post it there @gnat
Jun 26, 2014 at 16:04 comment added Hawk didn't know where to ask..thought i'd ask here
Jun 26, 2014 at 16:03 comment added gnat why didn't you ask at Stack Overflow? meta.stackexchange.com/a/129632/165773
Jun 26, 2014 at 16:01 history asked Hawk CC BY-SA 3.0