🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3014

Re: JOE 1.0.12 - Blurb

#3014
From: Norman Diamond
Date: Mon, 29 Aug 1994 01:27
27 lines
2097 bytes
In article <33kfu1$eff@usenet.pa.dec.com> diamond@jrd.dec.com (Norman Diamond) writes:
>In article <Cv4GDy.GMr@world.std.com> jhallen@world.std.com (Joseph H Allen) writes:
>>unsigned short a=1024;
>>unsigned short b=1024;
>>int c=311;
>>char *d="Hello there";
>>main() { printf("%x %x\n",d+c,d+a-(b-c)); }
>>
>>The fix for JOE is to change the two 'unsigned short's in the file b.h to
>>'int's.  This is truly a bizzare problem.

>The correct fix is to change the two '%x' conversions to '%hx' conversions.
>%x requires an unsigned int argument; %hx requires an unsigned short argument.

Sorry, I had noticed the "unsigned short" declarations and had not noticed
the "char *" declarations.  Someone pointed out by e-mail that these are
pointer expressions.  The correct fix is to use %p format (and pedantically,
to cast the pointer expressions to type (void *), but it is "intended" to
work without it because char * and void * have the same representation).
However, %hx or %x or %lx might work on some machines if you know the
sizes of the corresponding integral types and of char *.

[Notice to jik:  Sorry the amount of source here is only a few characters,
changing x or hx to p.  It is still source.]
--
 <<  If this were the company's opinion, I would not be allowed to post it.  >>
segmentation fault (california dumped)
Technical Details
Message-ID: <33rdi5$558@jrdgwm.jrd.dec.com>
Path: arc1-ca.pugleaf.net!wupost!uhog.mit.edu!news.kei.com!yeshua.marcam.com!charnel.ecst.csuchico.edu!olivea!decwrl!pa.dec.com!mets86.two.dec.com!jrd.dec.com!jrd.dec.com!diamond
References: <Cur3x5.A95@world.std.com> <Cv0B4q.EDu@world.std.com> <Cv1o5M.2GC@world.std.com> <Cv4GDy.GMr@world.std.com> <33kfu1$eff@usenet.pa.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!uhog.mit.edu!news.kei.com!yeshua.marcam.com!charnel.ecst.csuchico.edu!olivea!decwrl!pa.dec.com!mets86.two.dec.com!jrd.dec.com!jrd.dec.com!diamond
From: diamond@jrd.dec.com (Norman Diamond)
Newsgroups: comp.editors,alt.sources,comp.misc,comp.unix.misc,comp.mail.misc,comp.unix.admin
Subject: Re: JOE 1.0.12 - Blurb
Date: 29 Aug 1994 01:27:33 GMT
Organization: Digital Equipment Corporation Japan , Tokyo
Lines: 27
Distribution: inet
Message-ID: <33rdi5$558@jrdgwm.jrd.dec.com>
References: <Cur3x5.A95@world.std.com> <Cv0B4q.EDu@world.std.com> <Cv1o5M.2GC@world.std.com> <Cv4GDy.GMr@world.std.com> <33kfu1$eff@usenet.pa.dec.com>
Reply-To: diamond@jrd.dec.com (Norman Diamond)
NNTP-Posting-Host: jit533.jrd.dec.com