Subject: Re: Style guide
To: None <firstname.lastname@example.org>
From: Dennis Ferguson <email@example.com>
Date: 06/20/1997 12:12:24
> Ever tried to incorrectly promote a char to an int on a big endian machine?
> For a historical remark, a couple of FORTRAN programs which were running
> for years on VAXen, which passed INTEGER*4 to functions expecting
> INTEGER*2 parameters, mysteriously started to break when compiling and
> running them on the big-endian Convex C1 that MPIfR had aquired.
> This is exactly the kind of problem you'll see when not promoting char
> to int, where the callee expectis it promoted, on big endian.
No, different bug. FORTRAN compilers (at least last time I wrote a FORTRAN
program, long ago) generally pass parameters by reference since modification
of a parameter in a function needs to change the caller's version of the
parameter. The bug you're describing hence has nothing to do with integral
type promotion and everything to do with the implicit conversion of a
(u_int32_t *) pointer to a (u_int16_t *) pointer, something which has a
slightly happier result on little endian machines but which should draw
a warning in C with prototyped function declarations regardless. People
who wrote FORTAN programs for IBM mainframes knew not to do this anyway...