From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 13 Feb 2014 20:44:41 -0500 To: 9fans@9fans.net Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Strings in acid, what am I missing? Topicbox-Message-UUID: b9f8e144-ead8-11e9-9d60-3106f5b1d025 > > 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. almost, the \ expressions define the type of the object. you have to define the type before indirection is sensible. so you can say x\X (print a 4-byte integer), but *(x\s). > > 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! perhaps that's an arguable flaw in the compiler. in any event, the correct way to declare something used is USED(x, y, z) this is not a macro, but implemented by the compiler directly. SET() is analogous. - erik