Article View: comp.sys.atari.st
Article #24208MWC bug with structure assignment
From: R.P.A.Collinson
Date: Tue, 30 Dec 1986 20:21
Date: Tue, 30 Dec 1986 20:21
43 lines
1493 bytes
1493 bytes
On the whole MWC implements structure assignment correctly. However I
have found that an attempt to pass the result of a function returning
a structure into a routine as a parameter fails.
Perhaps a little example will make this clearer.
typedef struct
{ short x;
short y;
} Point;
main()
{ Point pt;
Point Pt();
pt = Pt(100, 200)
print_pt(pt); /* works */
print_pt(Pt(100, 200)); /* fails */
}
Point
Pt(x, y)
short x, y;
{ Point re;
re.x = x; re.y = y;
return(re);
}
print_pt(pt)
Point pt;
{ printf("x = %d, y %d\n", pt.x, pt.y); }
In the fail case, a pointer to a static(?) area gets passed into the code
and is not dealt with correctly.
I guess this is a case of `me need compiler fix' unless someone else
has a fix? This bug means that I cannot port a whole bunch of code using
Points and Rectangles using MWC.
PS. I am annoyed that I always seem to act as an unpaid compiler debugger for
the various commercial C compilers around.
Technical Details
Message-ID:
<2329@eagle.ukc.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!pcShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!pc From: pc@ukc.ac.uk (R.P.A.Collinson) Newsgroups: comp.sys.atari.st Subject: MWC bug with structure assignment Message-ID: <2329@eagle.ukc.ac.uk> Date: Tue, 30-Dec-86 15:21:49 EST Article-I.D.: eagle.2329 Posted: Tue Dec 30 15:21:49 1986 Date-Received: Wed, 31-Dec-86 03:51:16 EST Reply-To: pc@ukc.ac.uk (R.P.A.Collinson) Organization: U of Kent at Canterbury, Canterbury, UK Lines: 43