Re: Hijacked: C vs C++

w7hd.rh <w7hd.rh@...>
 

I can vouch for the size increase with C++.  When I was teaching C and just getting my feet wet with C++, we did a direct comparison.  The results showed a 1.5K executable for C and 80K for C++ with the exact same code, simply renaming it .C++ instead of .C.  It is due to the libraries being pulled in.  Speed is a different issue since it is highly dependent on coding style.

Ron W7HD

On 07/03/2018 01:15 PM, Jack Purdum via Groups.Io wrote:
Hi Jerry:

I've seen statements like this:

    It's always been straight C (K&R or ANSII) if I want to code for speed or size

many times before, but I've never seen any a priori proof of this or articles that discuss it. It seems that it would make sense to be so, but I don't know if that's pushed into the generated code or if it's an increased load on the parser given the semantics of C++ versus C. Some even say that, because C++ uses templates in the libraries, the code generator can perform more optimizations on the code because it "knows" what you are doing (What are the fundamental differences between C and C++?).


I don't have an answer, but I do try to follow the goals of C++ where it makes sense, especially encapsulation. If anyone has a definitive answer, I'd really like to know about it.

Jack, W8TEE



On Tuesday, July 3, 2018, 3:16:24 PM EDT, Jerry Gaffke via Groups.Io <jgaffke@...> wrote:


> I fail to see the their and there you are pointing out. 
 
What do you mean?
It's right their in this sentence: 

>>   "their" is possessional, "there" is positional, required in this context.


My gripes are mostly about a good technical discussions diverging into multiple threads.
If you do start a new thread on an old subject then post links to both showing where the other thread can be found. 

Those posting without any history for context generally get ignored.
If it's not worth your while to spend 5 seconds including context,
it's certainly not worth it for thousands of forum readers to go find it.

If anybody want's to pick apart my use of USAish or my C indentation style (or lack thereof), have at it.
I'm quite capable of skipping over those posts too.

And while I'm at it, I've never seen any reason to get comfortable with C++.
It's always been straight C (K&R or ANSII) if I want to code for speed or size,
and for the last couple decades I've been resorting to Python for easy coding. 
This violates my primary beef above, I do try not to be overly pendantic.

Jerry, KE7ER



On Tue, Jul 3, 2018 at 09:49 am, Allen Merrell wrote:
On Tue, Jul 3, 2018 at 08:46 am, Dexter N Muir wrote:
Sorry to be a pedant, but that's me Allen: "their" is possessional, "there" is positional, required in this context.
73
Dex, ZL2DEX
Sorry Dexter, I'm not an english major but I fail to see the their and there you are pointing out.
 
--
Allen  Merrell

-- 
Ron W7HD - NAQCC#7587 OMISS#9898 KX3#6966 LinuxUser#415320
Editor OVARC newsletter

Join BITX20@groups.io to automatically receive all group messages.