🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13894

Re: Manx 5.0 problems

#13894
From: Anthony M. Richardson
Date: Sun, 25 Feb 1990 15:00
50 lines
2394 bytes
In article <35312@grapevine.EBay.Sun.COM> golson@grapevine.EBay.Sun.COM (Greg Olson) writes:
:Hi everyone.  I've been using Manx 5.0 for a little while, and thought I'd 
:post a few problems I've run across.

[a few problems]

:	3) (Probably the most frustrating)  It seems that Manx doesn't handle
:	using new style prototyping and old style function definition parameter
:	promotion correctly.  For instance:
:
:		int test_func(int);	/* HAS TO BE INT FOR ANSI */
:		main(){test_func('X');}
:		int test_func(y)
:		char y;
:		{ printf("X = %c\n",y); }
:
:	will not print X to the screen (as it should, by my understanding of
:	ANSI promotion rules for new-style prototype/old style function
:	definitions).
:
:I have a few mail messages into Manx, but haven't heard word one as of yet.
:Can anyone verify/dispute these?

According to the second edition of Harbison and Steele - specifically
section 11.3.5 - which discusses DRAFT proposed ANSI C,

 "A function defined in traditional form does not introduce a prototype,
  but if a prototype exists because of a previous declaration, the 
  widened parameter declarations in the definition must agree exactly
  with the prototype and that prototype remains in effect."

and so the above would indeed be a bug.  I don't have a copy of the
standard, but believe this made it in. (Can anyone verify this?)

By the way, I don't think that Lattice does this correctly
either (assuming the above is in the standard). If a prototype exists
for a traditional form definition, then conversions are done according to
the prototype.  This means that the example above will work, as will,

		int test_func(char);
		main(){test_func('X');}
		int test_func(y)
		char y;
		{ printf("X = %c\n",y); }

This is certainly programmer friendly behavior, but not correct behavior.
(In this latter case the compiler should at least give a warning about
a mismatch between the declaration and the definition.)

Tony Richardson    amr@dukee.egr.duke.edu
Technical Details
Message-ID: <655@cameron.cs.duke.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!duke!cameron!dukee!amr
References: <1990Feb24.005652.971@oresoft.uu.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!duke!cameron!dukee!amr
From: amr@dukee.egr.duke.edu (Anthony M. Richardson)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Manx 5.0 problems
Message-ID: <655@cameron.cs.duke.edu>
Date: 25 Feb 90 15:00:53 GMT
References: <1990Feb24.005652.971@oresoft.uu.net>
Sender: news@cameron.cs.duke.edu
Lines: 50