Subject: Re: new openssl won't build on powerpc
To: gabriel rosenkoetter <gr@eclipsed.net>
From: Martin Husemann <martin@duskware.de>
List: current-users
Date: 04/16/2001 12:33:54
> > the variables are auto variables (on stack, not in structure nor union)
> > and are used just as flags. i don't think the use of char will help
> > anybody, or anybody cares.
>
> Machines with small quantities of memory will probably care if every
> char that "doesn't really need to be one" becomes an int. It's just
> a bad precedent to set, that's all.
No, you are missing something here:
- due to alignment constraints changing this single auto variable to
int (instead of "signed char") will not make a difference on many
platforms (if you have four bytes instead of four ints that would
be different [for 32 bit plattforms])
- there is a reason char is unsigned on some architectures, e.g. in the
case of PPC (IIRC) the sign extension when using this variable in an
integer expression (like passing to a variadic function) needs to be
done in software, causing quite a performance hit
Rule of thumb: if used as an int and no particular size restrictions apply,
just make it an int.
Martin