🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9414

Re: enum function bug?

#9414
From: Gary McKenney
Date: Thu, 25 Sep 1986 13:24
59 lines
1696 bytes
> > On a somewhat related matter, I noticed the following:
> > 
> > AT&T 5.2.2 source seems to accept the following, but Berkeley 4.2 & 4.3beta
> > give a warning of inconsistent usage.
> > 
> > struct st { int c ; } ; 
> > int func (b);
> >    int b; 
> > {
> > }
> > main()
> > {
> >    struct st s;
> >    func (&s);
> > }
> > 
> > If 's' were a character array, however, AT&T would also complain.
> > 
> > Dave Ray   --  uucp:  {ucf-cs|allegra}!novavax!hrshcx!hcx1!daver
> 
> Why don't you try:
> 
>      func (&s.c);
> 
> I think this will be excepted to both and it still points to the beginning
> of the structure.
> 
> 
> gbm

One additional comment (and error on my part).  Your function is suppose
to receive an integer, not a pointer to a structure.

if you intend to receive an integer in func() then you should code...

	struct st { int c ; } ; 
	int func (b);
	   int b; 
	{
	}
	main()
	{
	   struct st s;
	   func (s.c);
	}

else if you intend to pass a pointer to the structure then you should code...


	struct st { int c ; } ; 
	int func (b);
	    char *b; 
	{
	}
	main()
	{
	   struct st s;
	   func (&s.c);
	}
Technical Details
Message-ID: <672@galbp.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!codas!akguc!akgua!akgub!galbp!gbm
References: <103@hcx1.UUCP> <671@galbp.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!codas!akguc!akgua!akgub!galbp!gbm
From: gbm@galbp.UUCP (Gary McKenney)
Newsgroups: net.lang.c
Subject: Re: enum function bug?
Message-ID: <672@galbp.UUCP>
Date: Thu, 25-Sep-86 09:24:57 EDT
Article-I.D.: galbp.672
Posted: Thu Sep 25 09:24:57 1986
Date-Received: Tue, 30-Sep-86 07:38:13 EDT
References: <103@hcx1.UUCP> <671@galbp.UUCP>
Organization: Lanier Business Products, Inc., Atlanta, Georgia
Lines: 59