9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Grant R. Mather" <hcaulfield57@gmail.com>
To: 9fans@9fans.net
Subject: Re: [9fans] Strings in acid, what am I missing?
Date: Thu, 13 Feb 2014 18:38:46 -0700	[thread overview]
Message-ID: <a682f6f457c714eaa8187f29c2d86a91@yourdomain.dom> (raw)
In-Reply-To: <edf1c59a4c2b0756af6b6aaacf733b15@brasstown.quanstro.net>

> the reason that the () are required
> is that * binds tighter than \s in acid.  one thing that's confusing about
> acid is main:ca is an *address* of main:ca, not its value.  so *main:ca
> is the pointer into the bss, and main:ca is the address of that pointer.

So if I understand you correctly, in acid main:ca is the equivalent to
char ** in C? And furthermore that the \s expression operates on acid
addresses rather than normal char * in C? From trying things out in
acid a little bit, it seems like this is the case, but I'm not
positive.

> the reason cp gives you garbage is it's not initialized.  in fact when
> i compile this for am64, you can see everthing quite clearly.  it is
> optimized away!  (it's a good question why a char* is treated differently
> than a char[].  perhaps there is some dark corner of the standard that
> implies things.)

I see what you're saying about cp not being initialized, but I
compiled with the -N option and I assumed that this would rectify the
situation of things being optimized away.  Interestingly enough if I
do **main:cp\c in acid it gives me 'W', but *(main:cp\s) gives me
garbage, whereas *(main:ca\s) gives me "Hello".

Thanks for the response, any other help would be appreciated!




  reply	other threads:[~2014-02-14  1:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 16:21 Grant R. Mather
2014-02-12 16:38 ` erik quanstrom
2014-02-14  1:38   ` Grant R. Mather [this message]
2014-02-14  1:44     ` erik quanstrom

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=a682f6f457c714eaa8187f29c2d86a91@yourdomain.dom \
    --to=hcaulfield57@gmail.com \
    --cc=9fans@9fans.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).