From: Adam Thompson <arthompson1990@gmail.com>
To: Karl Dahlke <eklhad@comcast.net>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] Mix
Date: Tue, 24 Dec 2013 08:52:56 +0000 [thread overview]
Message-ID: <20131224085256.GD16257@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <20131123103625.eklhad@comcast.net>
On Mon, Dec 23, 2013 at 10:36:25AM -0500, Karl Dahlke wrote:
> It is reassuring, and unsettling, that you can mix C and C++.
> Here is a little program that is a mix of both, yet it compiles and runs fine.
>
> --------------------------------------------------
> #include <iostream>
> #include <string>
> #include <stdio.h>
>
> using namespace std;
>
> void duplicate( int& a, int& b)
> {
> a *= 2;
> b *= 2;
> }
>
> int main()
> {
> string s;
> getline(cin, s);
> cout << s << endl;
> int x = 6, y(7);
> duplicate(x, y);
> printf("%d,%d\n", x, y);
> }
> --------------------------------------------------
Slightly pedantic note about this, in c++ you *should* really use
#include <cstdio>
Rather than
#include <stdio.h>
You could also use
cin >> s;
Instead of
getline(cin, s);
For added c++-ness (due to stream operators).
>
> The point for us is that jsdom.c and jsdom.cpp
> might not have to be very different at all,
> since most of the c should carry along.
> Maybe we can get lucky and just change the calls to the js engine.
Hopefully, that and a few datatype changes.
Cheers,
Adam.
next prev parent reply other threads:[~2013-12-24 8:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-23 15:36 Karl Dahlke
2013-12-24 8:52 ` Adam Thompson [this message]
2013-12-24 9:30 Karl Dahlke
2013-12-24 13:09 ` Chris Brannon
2013-12-24 14:48 ` Chris Brannon
2013-12-24 15:30 ` Adam Thompson
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=20131224085256.GD16257@toaster.adamthompson.me.uk \
--to=arthompson1990@gmail.com \
--cc=Edbrowse-dev@lists.the-brannons.com \
--cc=eklhad@comcast.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).