William Chops" Westfield" wrote: > "in" seems useful, but do people use sets other than with "in" ? Yes. Often the set is really a collection of one-bit flags. For that purpose, you could use bitfields in C. The advantage of the Pascal set in that case is the strong type checking. For example, here is part of the definition of my low level integer to string conversion routine: type string_fi_k_t = ( {flags for converting integer to string} string_fi_leadz_k, {create leading zeros} string_fi_plus_k, {create plus sign if signed and > 0} string_fi_unsig_k); {input number should be treated as unsigned} string_fi_t = {all the FI flags in one set} set of string_fi_k_t; procedure string_f_int_max_base ( {make string from integer} in out s: univ string_var_arg_t; {output string} in i: sys_int_max_t; {input integer} in base: sys_int_machine_t; {number base for output string} in fw: string_index_t; {field width, use 0 for free form} in flags: string_fi_t; {addtional option flags} out stat: sys_err_t); {completion status} val_param; extern; Note the FLAGS argument. In C FLAGS would be just a integer and you'd probably have a bunch of #define "constants" you'd OR together to pass the flags parameter. Even using a enum would be better than #define string substitutions, but C programmers generally don't do that for some reason. However, there is basically no type checking using this method in C. In the Pascal above, you can only pass a collection of the STRING_FI_xxx_K constants. Trying to pass a integer value or constants that are members of a different set would get caught by the compiler. To show how this is used, here is a example call to this routine: string_f_int_max_base ( {make 32 bit HEX address string} hex, {output string} adr, {the address} 16, {radix (hexadecimal)} 8, {fixed field width} [ string_fi_leadz, {fill field with leading zeros} string_fi_unsig], {the input number is unsigned} stat); {returned completion status} If you accidentally used a flag intended for a different suboutine, like STRING_TI_NULL_Z_K which is for the string to integer subroutine, the compiler would catch it as a type mismatch. (Also note another nice thing about Pascal in that you can tell the compiler the direction arguments are being passed. As a result, no special syntax is necessary at the call for HEX and STAT, which you'd have to remember to pass the address of explicitly in C. I, BASE, FW, and FLAGS will automatically get passed by value with HEX and STAT passed by reference, which is a concept totally foreign to C.) ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist