Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!decwrl!wsl.dec.com!mikey From: mikey@wsl.dec.com (Mike Yang) Newsgroups: comp.windows.x Subject: Re: bug in XtGetApplicationResources Keywords: incorrect parsing of resources on sun 4 Message-ID: <3003@bacchus.dec.com> Date: 13 Mar 90 01:04:54 GMT References: <5061@helios.ee.lbl.gov> <5062@helios.ee.lbl.gov> Sender: news@decwrl.dec.com Reply-To: mikey@wsl.dec.com Organization: DEC Western Software Laboratory Lines: 32 In article <5062@helios.ee.lbl.gov>, envbvs@epb2.lbl.gov (Brian V. Smith) writes: > Why does it matter if the variable has a non-zero value to start? > Again, this is only a problem on a sun4 (running sunos4.0) and not > a problem on a Vaxstation (Ultrix 3.0) or DECstation 3100 (Ultrix 3.0) > > ... > > static XtResource application_resources[] = { > {XtNjustify, XtCJustify, XtRBoolean, sizeof(int), > (Cardinal)&RHS_PANEL, XtRBoolean, (caddr_t)&false}, > {"landscape", XtCOrientation, XtRBoolean, sizeof(int), > (Cardinal)&landscape, XtRBoolean, (caddr_t)&true}, > }; From the Intrinsics manual, "The resource_size field is the size of the physical representation in bytes; you should specify it as "sizeof(type)" so that the compiler fills in the value." Therefore, you should instead have: {"landscape", XtCOrientation, XtRBoolean, sizeof(Boolean), (Cardinal)&landscape, XtRBoolean, (caddr_t)&true}, The difference in sizes between Boolean, typedef'd to char, and int varies among machines and this probably made things work under Ultrix but not on your Sun. ----------------------------------------------------------------------------- Mike Yang Western Software Laboratory Digital Equipment Corporation mikey@wsl.dec.com decwrl!mikey 415/853-6677