How to do sets?

Henry Spencer henry at utzoo.uucp
Thu Mar 16 02:48:48 AEST 1989


In article <518taylorj at yvax.byu.edu> taylorj at yvax.byu.edu writes:
>Is there a way to do sets in C (like in Pascal)?  That is, check for set
>inclusion (char in ["0".."9"]), and perform unions and intersections.  And the
>answer is not "use bitwise operators," I already know how to do that and would
>rather not if there's an easier way, especially with large sets requiring 32
>bytes or more.

Why are you averse to bitwise operators?  That's how Pascal sets are almost
invariably implemented.  One can write C preprocessor macros that cover up
the details in somewhat the same way that Pascal does.
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list