public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* implicit casts in g++
@ 2003-12-09 16:21 Kalle Anderson
  2003-12-09 16:58 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Kalle Anderson @ 2003-12-09 16:21 UTC (permalink / raw)
  To: gcc-help

I have to port some legacy C code to another platform for testing 
purposes. I can't modify the code (for configuration management reasons) 
and for a reason I won't get into, I have to compile it as C++ code. 
However, it is doing lots of implicit pointer casts that the C compiler 
allowed. (void* to char*, etc...). Is there anyway compiler switch to 
make g++ ignore those errors? THanks,




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: implicit casts in g++
  2003-12-09 16:21 implicit casts in g++ Kalle Anderson
@ 2003-12-09 16:58 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2003-12-09 16:58 UTC (permalink / raw)
  To: Kalle Anderson, gcc-help

Hi Kalle,

Your options are:
1) Use a C compiler
2) Modify the code

Implicit pointer casts that are allowed by C are not allowed by C++.

Despite their many similarities, compliant C code is not always compliant C++ code.  Where C and C++ part ways is often troubled waters.  (Unfortuantely, C99 has widened the gap creating more troubled waters for those who have to have one foot in the C canoe, and another foot in the C++ canoe.)

>Is there anyway compiler switch to make g++ ignore those errors?

g++ -x c foo.cpp -o foo.o

HTH,
--Eljay


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-09 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-09 16:21 implicit casts in g++ Kalle Anderson
2003-12-09 16:58 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).