rpm, ppc and -fsigned-char

Pawel Sikora pluto at agmk.net
Tue May 10 00:07:23 CEST 2005


On Monday 09 of May 2005 22:25, Mariusz Mazur wrote:
> On poniedziałek 09 maj 2005 18:19, wrobell wrote:
> > $ rpm --showrc | grep fsigned-char
> > optflags              : -O2 -fsigned-char%{!?nospecflags:%{?specflags:
> > %{specflags}}%{?specflags_ppcpseries: %{specflags_ppcpseries}}} -11:
> > optflags   -O2 -fsigned-char%{!?nospecflags:%{?specflags:
> > %{specflags}}%{?specflags_ppc: %{specflags_ppc}}}
> >
> > As i understand it comes from rpm-rpmrc.patch.
> >
> > It generates a lot of noise due to char unsignedness on ppc platform.
> > For example many string.h functions use just char, it defaults to singed
> > char and properly written code gives warnings about signedness.
> >
> > Any reason to keep fsigned-char in this patch?
>
> Afaik it's supposed to make ppc more x86ish

The K&R book doesn't say if it's signed or not !!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That's up to the implementation.

AFAIK, we inherit the unsigned default from AIX.
IBM made char unsigned to match what they'd done
on S/370 and AS/400 hardware. On those platforms,
IBM was using EBCDIC instead of ASCII, and needed
to make char unsigned to prevent regular characters
(basic numbers and letters) from being negative...

But not many people were dumb enough to follow IBM.

The "char" type was not specified as either signed
or unsigned. This sin has probably wasted more CPU
time than any other, as savvy programmers learn to
put a defensive "&0xFF" after every "char" expression
that needs to be unsigned.

> and in turn increase the percent of applications
> that just work.

To work or not to work? ;)
This is a platform dependent issue.

Programmers should always use a `signed` or `unsigned`
keyword to specify compiler's behav.

Regards,
Paul.

-- 
The only thing necessary for the triumph of evil
  is for good men to do nothing.
                                           - Edmund Burke




More information about the pld-devel-en mailing list