Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Feb 2005 14:32:41 -0500
From:      Charles Swiger <cswiger@mac.com>
To:        Jonathon McKitrick <jcm@FreeBSD-uk.eu.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Unix equivalent of a variant??
Message-ID:  <62f97b906f93154c70f01d754d50083c@mac.com>
In-Reply-To: <20050201164337.GA78979@dogma.freebsd-uk.eu.org>
References:  <20050201164337.GA78979@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 1, 2005, at 11:43 AM, Jonathon McKitrick wrote:
> I need the equivalent of a variant, however.  A hold-everything 
> variable
> that can be any type in C/C++.  Is there something already out there I 
> can
> use or should I just roll my own?

Your question probably belongs on comp.lang.c, but the cannonical way 
of handling "data of any type" is a memory buffer and a (void *).  
Watch out for host data alignment restrictions.

-- 
-Chuck



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?62f97b906f93154c70f01d754d50083c>