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

Reply via email to