Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: linux-ipsec: Building freeSwan on DEC Alpha pt 3 :-)

From: Henry Spencer <henry(at)spsystems.net>
Date: Thu Nov 26 1998 - 14:24:25 EST


> > Sizeof(long) = 8

And what happens when, say, the Alpha switches to 8-byte ints? (It could happen; 64 bits is the natural data width on that machine.) No, it's time to start using typedefed types which express the width in terms of our requirements, and which are defined in central place(s) so they can be adjusted easily. For example (I haven't looked at the code lately so this may already be right), a variable holding an SPI should be spi_t or uint32_t or something like that, so that the assumption that (say) int is 32 bits appears only in the declaration of spi_t, not spread everywhere in the code.

> Understood. The parts that I am concerned about are *print?() statements

Correct. Which means that a variable of type (say) spi_t must be cast to a known size before printing it -- never assume it's something specific. (See above comment about keeping assumptions in one place.)

We *can* safely assume that int is *at least* 32 bits... but not that it is exactly 32.

                                                          Henry Spencer
                                                       henry@spsystems.net
                                                     (henry@zoo.toronto.edu)
Received on Thu Nov 26 14:56:13 1998

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 12:59:08 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library