🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x.kde
Article #42

Re: Turn off type casting errors?

#42
From: dmills
Date: Sat, 15 Jan 2000 00:00
53 lines
2005 bytes
god_of_pain@my-deja.com wrote:
> Basicly:
> I keep getting a type casting error that I need to turn off. Is there an
> option for the gcc or g++ compiler that stops it from checking type?


> In detail:

> //---------
> //example
> struct test
> {
> 	char first;
> 	char second;
> 	char third;
> };


> struct test far MyTest;
> void SomeFunction(char far *StructPointer);

Why not change the definition of SomeFunction to:
void SomeFunction (struct test *StructPointer);
Then you dont need to cast at all!!
BTW I dont think far is recognised by gcc as a valid keyword??
possibly add somthing like

#ifdef __GNUC__
#define far
#endif

to the top of the file??


> void main(void)
> {
> 	// This line compiles with gcc, not with the embeded compiler
> 	// This would be the better way to do it, but the embeded
> 	// compiler could take months to be fixed and I don't want to
> 	// work in windoze, there should be a way to let gcc ignore the
> 	// type cast?!? Right?
> 	SomeFunction((char *)&MyTest);

#ifdef __GNUC__
SomeFunction ((char*)&MyTest);
#else
SomeFunction(&MyTest);
#endif

Regards, Dan.

-- 
The email address **IS** valid, you do  NOT  need to remove spamblock.
Technical Details
Message-ID: <hepo58.u91.ln@spamblock.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <85ogd7$pqb$1@nnrp1.deja.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,6d8e632080002765
X-Google-Attributes: gid11318c,public
X-Google-Thread: 10baf0,6d8e632080002765
X-Google-Attributes: gid10baf0,public
From: dmills@spamblock.demon.co.uk
Subject: Re: Turn off type casting errors?
Date: 2000/01/15
Message-ID: <hepo58.u91.ln@spamblock.demon.co.uk>
X-Deja-AN: 572853569
X-NNTP-Posting-Host: spamblock.demon.co.uk:212.228.42.173
Sender: root <root@spamblock.demon.co.uk>
References: <85ogd7$pqb$1@nnrp1.deja.com>
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 947909611 nnrp-09:10445 NO-IDENT spamblock.demon.co.uk:212.228.42.173
Organization: ???
User-Agent: tin/pre-1.4-980618 (UNIX) (Linux/2.2.7 (i586))
Newsgroups: comp.windows.x.kde,gnu.gcc.help