binary constants (??)

Chris Torek chris at mimsy.umd.edu
Wed Nov 29 17:29:47 AEST 1989


In article <20830 at mimsy.umd.edu> I wrote:
>... This would be useful for obfuscation such as
>	#(3+#(2,#(6,13)-0010),#(5,11)/30)
>which is actually 1.  (I think.)

Too much obfuscation; it comes out to 0.2, which truncates (integer
arithmetic) to 0.  That should have been #(5,110) in there.

Anyway, while specific syntaxes for specific bases (8 and 16, and
perhaps 0b for 2 as well, in addition to the `plain' base 10) are
all well and good, it is often better to get rid of specifics and
move toward abstracts.  Those of you who are trying to design `D'
(or `P') might consider dumping 0-octal and 0x-hex in favour of
something sane, like <base>r<text>, 2r11001 = 8r31 = 25 = 16r19.
Or for the mathematically TeXish, perhaps <text>_<base>: 11001_2 =
31_8 = 25 = 19_16 = 0p_36.  (Of course in TeX one has to write
19_{16}....)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list