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.
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev

Reply via email to