Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!udel!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Pascal to C (and vice versa) Message-ID: <20364@mimsy.umd.edu> Date: 24 Oct 89 16:20:47 GMT References: <5164@uhccux.uhcc.hawaii.edu> <4640@mentor.cc.purdue.edu> <20355@mimsy.umd.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 23 In article <20355@mimsy.umd.edu> I wrote: [regarding >> X := X * ['b','c']; where `X' is a `set of char'] > SETINTERSECT(X, 256, 'b'), SETINTERSECT(X, 256, 'c'); >which (as you can see) is not very nice. Oops. It is also not very right. Set intersection done the hard way requires a temporary set. Since this is a constant intersection, a Pascal-to-C translator could rewrite it as X[0] = X[1] = X[2] = X[3] = X[4] = X[5] = X[6] = X[7] = X[8] = X[9] = X[10] = X[11] = X[13] = X[14] = X[15] = 0, X[12] &= (2|4); (assuming ASCII characters). More likely, it would create a local variable containing another 256-bit set, clear it all, set bits for 'b' and 'c', and then call a set-intersection macro. -- `They were supposed to be green.' In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris