🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52589

Problems with Xview library call

#52589
From: Dan Harling
Date: Thu, 25 Jun 1992 14:52
40 lines
2439 bytes
I recently finished converting a SPARC application from Sun's K&R
'C' compiler ('cc') to Gnu C.  Everything works exactly as it did
before, with a single exception: selection_inquire().

I use this function in getting a copy of the text string that is
currently highlighted.  It is declared in the Xview include files as:

	EXTERN_FUNCTION (Seln_holder selection_inquire, (Xv_Server
			 server, Seln_rank which));

The type "Seln_holder" is a structure:

	typedef struct	{
	    Seln_rank           rank;	/* an "enum" */
	    Seln_state          state;	/* an "enum" */
	    Seln_access         access;	/* a "struct" */
	}	Seln_holder;


Under 'cc', the struct variable that receives the return value contains
appropriate values when the call returns.  Under 'gcc' the struct
variable is not changed at all; its uninitialized contents are
identical before and after the call.

I suspect the problem lies with the way in which the compilers handle
assignments to structures, and structures as return values.  Is it
possible that 'cc', a K&R compiler, assumes that returning a struct
really means returning a struct *pointer*, whereas 'gcc' expects the
actual struct to be returned (in other words, could this be an ANSI vs.
K&R conflict)?

In any case, I will have to continue compiling the one file containing
this one function with 'cc' instead of 'gcc', until I can figure this
out.  I have also contacted Sun on this problem, and they are
investigating it.  I would appreciate any help or suggestions you may
have to offer.  Thanks.
____________________________________________________________________________
Daniel A. Harling                        (harling@pictel.com)
PictureTel Corp.             Opinions expressed are not necessarily those of
Peabody, MA  01960                 PictureTel, but they ought to be!
Technical Details
Message-ID: <9206251452.AA00376@roadrunner.pictel.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!roadrunner.pictel.com!harling

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,f008f4115c16a3e9,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-06-25 02:36:20 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!roadrunner.pictel.com!harling
From: harling@roadrunner.pictel.com (Dan Harling)
Subject: Problems with Xview library call
Message-ID: <9206251452.AA00376@roadrunner.pictel.com>
Sender: daemon@cis.ohio-state.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 25 Jun 1992 14:52:02 GMT
Lines: 40