edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] Mix
Date: Tue, 24 Dec 2013 04:30:18 -0500	[thread overview]
Message-ID: <20131124043018.eklhad@comcast.net> (raw)

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.

> You could also use
> cin >> s;
> Instead of
> getline(cin, s);

This is not true.
If someone types in the line

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.
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.

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.

Karl Dahlke

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-24  9:30 Karl Dahlke [this message]
2013-12-24 13:09 ` Chris Brannon
2013-12-24 14:48 ` Chris Brannon
2013-12-24 15:30 ` Adam Thompson
  -- 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=20131124043018.eklhad@comcast.net \
    --to=eklhad@comcast.net \
    --cc=Edbrowse-dev@lists.the-brannons.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 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).