[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Looking for a temporary account on Alpha



Frank B Brokken <f.b.brokken@rug.nl> writes:

> Well, first of all, thanks for your help. I'm sure it'll solve the
> problem for the time being. But I'm left with an uneasy feeling. On the
> one hand I know that what you write is true in principle. But on the
> other hand, I'm curious about what might be going on in the Alpha what
> apparently doesn't happen on other architectures. What's a size_t in the
> Alpha? If it's not in fact an unsigned int but something bigger then I
> understand what's happening.

size_t is 64 bits on the Alpha, whereas int is 32 bits.  (long is 64 bits,
as are pointers.)  This is a common pattern for 64-bit operating systems.

> The intention here is to use size_t in situations where the value is
> known to be non-negative. So, it may very well be an initialization
> problem, which should then also be solved by initializing nargs to 0
> when it's defined.

Writing a 32-bit value into the first half of a 64-bit variable (which is
what happens when you pass a size_t * as an int * and then write to it)
isn't guaranteed to get you anything useful regardless of how you
initialize it beforehand.  It's also a violation of the C aliasing rules,
which means that the compiler is permitted to mess with your code in ways
that might break because it's allowed to assume that you won't ever do
something like that.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: