[ale] more OT: c++ datatypes question
John Mills
johnmills at speakeasy.net
Mon Jun 7 16:56:05 EDT 2004
Jenn --
On Mon, 7 Jun 2004, J.M. Taylor wrote:
> I would love to know how WORD is defined. It's not actually defined
> anywhere in the code that I'm working with, but to do a palm conduit you
> have several .dll dependancies that load all manner of things that are
> core to Palm conduits. Which I can't look at, of course. Is
> there some way to see the definition in this case, that I just don't know
> about? I know so little about visual studio, or dealing with MS based
> things in general. (ick)
I guess you need to look at 'representation' or 'storage' in the compiler
manual (or M$'s web site). Sorry, I don't know off-hand where that
information lives for VS/VC++.
In *nix, you could crank up 'gdb' and ask it:
> print sizeof(WORD)
There should be definitive information in '/usr/include/*/types.h', or
close.
You may find WORD is undefined. I have a definition set of common data
type I include when dealing with cross-Win/Lin sources. For example, I
code with the type 'I32' and this is translated to 'WORD' if it's a
Windows environment and 'int32_t' for 'gcc' (i.e., Linux). You can grow
this kind of thing as you work. I test the environmental '__GNUG__' to
identify the setting - there are lots of finer tests, but this is enough
for my targets.
I '#include' the defining header in any file that needs it, and add
definitions to it as I need them.
I'm sure others here have better ways, but that's my $0.02.
- John Mills
john.m.mills at alum.mit.edu
More information about the Ale
mailing list