delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/16/23:38:28

Message-ID: <009801bd995b$02978500$0a4e08c3@arthur>
From: "Arthur" <arfa AT clara DOT net>
To: "DJGPP Mailing List" <djgpp AT delorie DOT com>
Subject: Re: C vs C++
Date: Tue, 16 Jun 1998 19:52:38 +0100
MIME-Version: 1.0

>Are there any differences in the question of speed
>between executables of the same source codes (consisting
>of only basic C functions) compiled in C and C++ by gcc?
>
>(I used to think that C++ is slower for it's objective
>language, and I don't know whether it's true or not...)


I'm not sure that compiling a C program in C++ would make much of a
difference at run time. When using objects, it is very much slower because
of the way all the functions have to be laid out in memory, when turning the
source into ASM. Using objects also increases executable size.

I honestly don't think that the trade off between speed and objective
programming is worth the effort - I've never used objects much because of
the speed and size of the executable. Besides, it's getting dangerously
close to using a library, which I strongly dislike. Still, that's my
opinion.

C++ allows you to have tighter C code, but I think that the final ASM is
slightly more complex, and hence slower. You could always compile it to ASM
then make the code more streamlined yourself...

James Arthur
jaa AT arfa DOT clara DOT net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019