[vtkusers] vtkConfigure.h and machine byte ordering: do I worry too much?

Robert Belleman robbel at science.uva.nl
Mon Apr 9 04:20:51 EDT 2001


Hi all,

In response to the email from Jose Romero a short while ago, something
got me thinking...

I maintain an installation for Solaris/sparc, Linux/i386, and Irix/mips
systems from a single source tree.  People use this source tree to obtain
the include files for their C++ programs.

This includes vtkConfigure.h, which (amongst others) defines
VTK_WORDS_BIGENDIAN to signify the byte ordering of the architecture.
In my case, this will be defined on some systems (my sparc and mips
systems) and not on others (the i386 systems), depending on the
architecture where I run configure.

In my case, common/vtkConfigure.h will only reflect the "correct"
settings for the *last* system I configured. In general this is not a
problem since none of Vtk's include files rely on this constant in the
headers, only in .cxx files, which in my opinion is good practice. 

However, users could check for this constant in their C++ programs
(instead of determining byte ordering at run-time). In principle their
code could think their running on a little endian system while, in fact,
it is a big endian machine...

I haven't seen my users relying on vtkConfigure.h definitions yet, but
in principle they could. We may want to think of a way to avoid these
problems from happening (e.g. all compilers that I know have a compile
time constant to signify the machine architecture which could be tested
to "protect" the definition of VTK_WORDS_BIGENDIAN). The same applies
to other definitions in common/vtkConfigure.h and those in vtkToolkits.h.

Any thoughts on this?

Best,
-- Rob

[] Robert Belleman         X  Section Computational Science            []
[] robbel at science.uva.nl  |X| University of Amsterdam, the Netherlands []
[] tel: (+31) 20 525 7510  X  http://www.science.uva.nl/~robbel/       []




More information about the vtkusers mailing list