edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
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 15:30:17 +0000	[thread overview]
Message-ID: <20131224153017.GA18259@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <20131124043018.eklhad@comcast.net>

On Tue, Dec 24, 2013 at 04:30:18AM -0500, Karl Dahlke wrote:
> Adam writes:
> 
> > Slightly pedantic note about this, in c++ you *should* really use
> > #include <cstdio>
> > Rather than
> > #include <stdio.h>
> 
> But that's my point, isn't it?
> We don't have to change everything over right away for it to work.
> Maybe we should, someday, but we don't have to, not right away.
> The preexisting code works.

Yep, I was just pointing it out, though it's certainly not required.

> 
> > You could also use
> > cin >> s;
> > Instead of
> > getline(cin, s);
> 
> This is not true.
> If someone types in the line

Good point, I forgot about the whitespace,
probably because I never use a plain cin >> to do input.

> hello world
> 
> The first construct will capture only hello, a string separated bye whitespace,
> whereas getline() captures the entire line.
> The tutorial recommends using getline,
> because you know exactly what you are getting, the line as it was typed.
> It doesn't vary with whitespace.
> Then you can analyze it and take action accordingly.
> So when I do convert edbrowse to c++,
> I can replace fgets with getline.
> Still there are advantages.
> I don't have to have a fixed buffer of a fixed size,
> or worry about what happens if the user types in a line longer than that buffer,
> or clip crlf off of the entered line;
> c++ does all that for us.

Technically, if building with gcc (or against readline I *think*),
you can do this anyway.

> So there are still some big advantages to c++, and yet,
> you can't really go all the way over to the shorthand that your
> professor put up on the board and showed you how cool it is.

Nope, and personally I don't actually think this syntax is "cool" either.

> 
> Yes I will globally replace bool with eb_bool.
> Obviously I thought the bool datatype was very useful,
> but I hadn't anticipated the collision with bool in c++.
> Thanks for spotting that one.
> I'll make that change and push in the next day or so.

Already made, also have replaced true and false with eb_true and eb_false.
Patches to be sent in a few minutes.

Cheers,
Adam.

  parent reply	other threads:[~2013-12-24 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-12-23 15:36 Karl Dahlke
2013-12-24  8:52 ` 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=20131224153017.GA18259@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).