[ale] more OT: c++ datatypes question
Benjamin Scherrey
scherrey at proteus-tech.com
Mon Jun 7 17:12:00 EDT 2004
Jenn,
Actually in *SOME* header that is being included by your code the definition of WORD
must exist otherwise you'd get a compile error and never make it to a link phase to even test the
execution. It could very well be that there is a declaration of WORD in your MSVC environment that
conflicts with the definition used by and compiled into the Palm .dlls which would explain the
runtime trap. One way to discover where this exists at is to declare your own version of WORD right
about its first usage. The compiler should flag this as a warning or error and show you BOTH
locations where it is defined. See how they compare and try to find a definition somewhere in the
Palm source or headers for WORD as well.
Things to also try: Don't use WORD at all. Declare your own with a reasonable definition
and use it instead. See what kind of errors/warnings you get. I'd suggest 'typedef MyWord
unsigned short;' and use MyWord throughout as a replacement for WORD. Microsoft's definitions
are unusually vauge or misleading quite often and their use of hungarian notation is an attempt to
work around the problem that is fundamental to their poor coding constructs. My advice is to use as
few of them as possible. Not knowing too much about the Palm architecture, if unsigned short
doesn't work also try unsigned char or unsigned int. One of these *should* match your target
environment.
Regardless, it appears that you have a serious environmental issue. If the above doesn't
get you going, you need to step back and create new, minimalistic project. Then write a little bit of
easy code that does nothing but confirm you're working. Try out environment changes on that to
see what their effects are. Common issues such as word/byte alignment and little-endian/big-
endian conversions should be resolved in this manner. Once you've got something basic running,
back it up and only add new code a bit at a time, fully testing & backing it up before adding
something new. Finally - KILL ALL WARNINGS! I mean, build with all warnings turned on and make
the code changes necessary to eliminate each one from appearing. The minimalistic project is a
great way to start this because sometimes, a set of existing code is just too screwed up to ever
achieve this goal. The warnings may not seem to have anything to do with the issues you are
having but understand that the semantics processing of compilers and handling of exceptions is still
quite primative today. The fact that you get a warning at all means, in the best case, that something
potentially indeterminate exists in your code and, until quantum computers get more popular, that's a
good reason to be concerned.
good luck,
Ben Scherrey
6/7/2004 4:49:50 PM, "J.M. Taylor" <jtaylor at onlinea.com> wrote:
>Ben,
>
>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)
>
>Also, yes, int i; i=2; works just fine.
>
>Thanks
>jenn
>
>On Mon, 7 Jun 2004, Benjamin Scherrey wrote:
>
>> Jenn,
>>
>> Check and see what the definition of WORD is in your environment. I presume that 'int i;
>> i=2;' works just fine? If its a macro or typedef of another typedef keep following it until you get to
its
>> fundamental C type. This could also be some strange linkage issue. Check and see what
linkage
>> options you have and try, for purposes of testing, to statically link all runtime libraries into your
>> executable.
>>
>> Good luck,
>>
>> Ben Scherrey
>
>_______________________________________________
>Ale mailing list
>Ale at ale.org
>http://www.ale.org/mailman/listinfo/ale
>
More information about the Ale
mailing list