unsigned sizeof()

Mark Delaney mdelaney at infmx.UUCP
Sat Feb 17 13:59:25 AEST 1990


In article <12141 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>In article <6042 at arctic.nprdc.arpa> stanonik at nprdc.navy.mil (Ron Stanonik) writes:
>>Sorry if this is old news.  It was a surprise to us; ie, sizeof
>>on our suns and vax (4bsd) returns signed.
>
>Well, their C compilers were based on old, decrepit versions of PCC.
>And non-portable programs abound, so you really shouldn't be surprised
>that you encountered one.

We too were surprised when this sizeof() caused problems while porting.
Does anyone know of a product (free or purchased) that runs on SunOS that 
could help in finding these little unportable problems?  I checked in the
fall 1989 edition of Catalyst (catalog of third-party products for Suns),
but didn't find anything helpful.  I use lint, but it doesn't catch the 
sizeof() problem.  I would upgrade to ANSI C but we don't have ANSI C 
compilers on all of the machines we port to.  I heard gcc has some good 
warnings build in; has anyone with gcc found that it catches this problem 
when the warning flag is on.

Oh yea, please don't flame me about good programming practices would solve
this problem.  I try to write portable code, but still some bugs get through.

                                              - Mark Delaney



More information about the Comp.unix.wizards mailing list