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] pst
Date: Mon, 27 Jan 2014 17:18:46 -0500	[thread overview]
Message-ID: <20140027171846.eklhad@comcast.net> (raw)

As we take some steps towards c++,
you notice I use the type pst,
which is a typedef in eb.h,
which is suppose to remind you of a perl string.
This is evolution.
Remember that edbrowse version 1 was written in perl,
and is still available.
A perl string is nice for many reasons but one is that it can hold \0.
Null does not end the string.
So each line of a file is held in a perl string, and if the line has nulls in it,
like when you download a binary file, that's ok.
When I moved from perl to C I had to reconstruct all this,
and have my own "strings",
like perl strings, that would work for me.
In this case I use newline as the end character, not \0.
So that's what pst is all about.

Well I just did a check with strings in c++ and they are perl style strings,
so that's good, and will make things easy.
This snippit of code shows, keeping both hello and world in s.

string s;
s = "hello";
s += '\0';
s += "world";
cout << s.size();
cout << s << endl;

You probably knew all this anyways but I like to figure things
out by playing with it.

Karl Dahlke

                 reply	other threads:[~2014-01-27 22:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140027171846.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).