delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/10/07:30:13

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC warning - incompatible pointer type
Date: 10 Feb 2003 10:18:07 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 22
Message-ID: <b27u8v$fvk$1@nets3.rz.RWTH-Aachen.DE>
References: <200302081532 DOT h18FW3u24717 AT speedy DOT ludd DOT luth DOT se>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1044872287 16372 137.226.32.75 (10 Feb 2003 10:18:07 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 10 Feb 2003 10:18:07 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

ams AT ludd DOT luth DOT se wrote:

> Evidently the C idea of every pointer is compatible to "void *"
> doesn't extend to "void *"s in functions.

More precisely, it doesn't extend to function pointers.  Pointers to
functions are quite strict in their compatibility requirements.  It's
best to assume that you should never, ever, cast a function pointer,
or use a function pointer of a given type where a function pointer of
*any* other type is asked for.

> Alternatively is should be a safe to use strcmp directly (but don't
> hold me to this in court), so a functioncast (if possible) would make
> the compiler quiet.

That cast would be a placebo solution.  It solves exactly none of the
problems that the language makers saw, and which made them require
this particular warning in the definition of standard C.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019