🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #294

Version 1.0 type coercion problems

#294
From: Graham D Parrington
Date: Fri, 29 Aug 1986 12:10
27 lines
1428 bytes
The following program generates an error from the 1.0 version of C++

extern void Set(char *);

void Test (char a)
{
	Set(&a);
}

The error message is:

"Test.c", line 5: error: bad argument 1 type for Set(): int * (char * expected)

The problem appears to be that the argument 'a' to Test is forced to int by
cfront so that taking its address gives an int* rather than the required
char*. Putting in an explicit coercion or assigning 'a' to a local and passing
that instead cures the problem. Unfortunately fragments of code like the
above are generated automatically by an RPC stub generator we are writing.

Does anybody have a fix for this for 1.0 and does the problem persist into
1.1?

Graham D Parrington
    Computing Lab, University of Newcastle upon Tyne, UK

ARPA:    graham%cheviot.newcastle.ac.uk@cs.ucl.ac.uk
UUCP:    <UK>!ukc!cheviot!graham
Technical Details
Message-ID: <987@cheviot.newcastle.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!cheviot!graham

Show 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!cheviot!graham
From: graham@cheviot.newcastle.ac.uk (Graham D Parrington)
Newsgroups: net.lang.c++
Subject: Version 1.0 type coercion problems
Message-ID: <987@cheviot.newcastle.ac.uk>
Date: Fri, 29-Aug-86 08:10:30 EDT
Article-I.D.: cheviot.987
Posted: Fri Aug 29 08:10:30 1986
Date-Received: Sat, 30-Aug-86 21:48:31 EDT
Reply-To: graham@cheviot.newcastle.ac.uk (Graham D Parrington)
Organization: U. of Newcastle upon Tyne, U.K.
Lines: 27