[plt-scheme] Cooperating with 3m

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jan 2 23:25:47 EST 2006

At Mon, 02 Jan 2006 20:59:52 -0700, Chongkai Zhu wrote:
> Yes. The previous line (line 52) contains an expression
> 
> 	arg+(argc+1)
> 
> The data type is
> 
> 	int argc;
> 	char **arg;
> 
> And arg contains strings only used in C (command line arguments).
> Could you please improve the heuristic to support the addition 
> of an address and an integer? Or must I rewrite the expression to
> something such as
> 
> 	(char**)((unsigned int)arg+(argc+1)*sizeof(char*))
> 
> ?

The simplest solution is to declare arg as

 GC_CAN_IGNORE char **arg;

The `GC_CAN_IGNORE' tag is recognized by xform and thrown away. For
non-xform compilation, you'll need

 #ifndef MZ_PRECISE_GC
 # define GC_CAN_IGNORE /* empty */
 #endif


There are many other xform hacks that are undocumented, so far.
(Another one is `XFORM_OK_PLUS', which xform converts to `+' without
complaining about pointer arithmetic.) Hopefully, the current stop-gap
xform will be replaced by a solid tool before much longer. Meanwhile,
it's on my to-do list to document more of the hacks.

Matthew



Posted on the users mailing list.