All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zan Lynx <zlynx@acm.org>
To: root@chaos.analogic.com
Cc: Bart Samwel <bart@samwel.tk>,
	Ashish sddf <buff_boulder@yahoo.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Compiling C++ kernel module + Makefile
Date: Tue, 20 Jan 2004 10:34:39 -0700	[thread overview]
Message-ID: <1074620079.22023.26.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.53.0401201000490.11497@chaos>

[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]

On Tue, 2004-01-20 at 08:20, Richard B. Johnson wrote:
> Nevertheless, I provide three programs, one written in
> C, the other in C++ and the third in assembly. A tar.gz
> file is attached for those interested.
> 
> -rwxr-xr-x   1 root     root        57800 Jan 20 10:16 hello+
> -rwxr-xr-x   1 root     root          460 Jan 20 10:16 helloa
> -rwxr-xr-x   1 root     root         2948 Jan 20 10:16 helloc
> 
> The code size, generated from assembly is 460 bytes.
> The code size, generated from C is 2,948 bytes.
> The code size, generated from C++ is 57,800 bytes.
> 
> Clearly, C++ is not the optimum language for writing
> a "Hello World" program.

I like C++ and hate to see it so unfairly maligned.  Here's a much
better example:

Makefile:
helloc: hello.c
        gcc -Os -s -o helloc hello.c
 
hellocpp: hello.cpp
        g++ -Os -fno-rtti -fno-exceptions -s -o hellocpp hello.cpp

Both programs contain exactly the same code: one main() function using
puts("Hello world!").

# ls -l
-rwxrwxr-x    1 jbriggs  jbriggs      2840 Jan 20 10:02 helloc
-rwxrwxr-x    1 jbriggs  jbriggs      2948 Jan 20 10:06 hellocpp

108 extra bytes is hardly the end of the world.
-- 
Zan Lynx <zlynx@acm.org>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-01-20 17:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 21:09 Compiling C++ kernel module + Makefile Ashish sddf
2004-01-16 22:07 ` Richard B. Johnson
2004-01-17 12:59   ` Bart Samwel
2004-01-19 13:46     ` Richard B. Johnson
2004-01-19 17:40       ` Bart Samwel
2004-01-19 18:39         ` Richard B. Johnson
2004-01-19 20:02           ` Bart Samwel
2004-01-19 20:37             ` Richard B. Johnson
2004-01-19 21:24               ` Bart Samwel
2004-01-20 15:20                 ` Richard B. Johnson
2004-01-20 17:34                   ` Zan Lynx [this message]
2004-01-20 18:10                     ` Richard B. Johnson
2004-01-20 13:38                       ` Thomas Lahoda
2004-01-21  2:24                       ` Michael Clark
2004-01-20 18:16                     ` Chris Friesen
2004-01-21 17:01                 ` Giuliano Pochini
2004-01-21 17:16                   ` Bart Samwel
2004-01-20  0:59               ` Robin Rosenberg
2004-01-20  6:46                 ` Linus Torvalds
2004-01-20  7:32                   ` Robin Rosenberg
2004-01-20 10:46                   ` Bart Samwel
2004-01-20  5:29         ` Valdis.Kletnieks
2004-01-20  9:48           ` Bart Samwel
2004-01-16 22:40 ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2004-01-19 13:21 Petr Vandrovec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1074620079.22023.26.camel@localhost.localdomain \
    --to=zlynx@acm.org \
    --cc=bart@samwel.tk \
    --cc=buff_boulder@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.