[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: (OT) Defining Variables in C with Bases other than 2 or 16



also sprach Martin McCormick <martin@dc.cis.okstate.edu> [2005.02.14.1525 +0100]:
> typedef char		boolean;		/* boolean data type */
> 
> Is there a similar method of defining a variable such as base 12
> or 24 or any arbitrary value?

No. You will have to use macros or the like to turn an array of ints
into a bitmask. Don't forget to think about endianness, should the
data ever leave your code.

Do you just want a type with different minimum and maximum values?
If yes, then consider simply scaling the ranges to 32bit, using
assertions, or simple error checking instead.

-- 
Please do not send copies of list mail to me; I read the list!
 
 .''`.     martin f. krafft <madduck@debian.org>
: :'  :    proud Debian developer, admin, user, and author
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP subkeys? Use subkeys.pgp.net as keyserver!

Attachment: signature.asc
Description: Digital signature


Reply to: