[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-dtrace-discuss
Subject:    Re: [dtrace-discuss] When is a string constant not a string
From:       Joerg.Schilling () fokus ! fraunhofer ! de (Joerg Schilling)
Date:       2009-08-07 16:01:58
Message-ID: 4a7c4ff6.dqEFnlbQs4OUPaqO%Joerg.Schilling () fokus ! fraunhofer ! de
[Download RAW message or body]

Hamish <hamish@gmail.com> wrote:

> AKA, what's wrong with the following? Isn't a string literal always a constant?
> 
> $ cat > cfretain_calayer.d
> pid$target::CFRetain:entry
> {
> isaptr = *(uint32_t*)copyin(arg0, 4);
> classnameptr = *(uint32_t*)copyin(isaptr+8, 4);
> classname = copyinstr(classnameptr);
> 
> p = (classname == "CALayer" ? "CFRetain(CALayer)\n" : "");
> printf(p);
> }
> 
> $ sudo dtrace -p 31303 -s cfretain_calayer.d 
> dtrace: failed to compile script cfretain_calayer.d: line 8: printf( ) argument #1 \
> is incompatible with prototype:  prototype: string constant
> 	 argument: string

It is not simple for a compiler to check this
as p is definitely not a string constant but only pointing to one.


Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de                (uni)  
       joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic