Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jan 1999 11:18:09 +0000
From:      Brian Somers <brian@Awfulhak.org>
To:        Matt Dillon <dillon@FreeBSD.ORG>
Cc:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/sys kernel.h 
Message-ID:  <199901291118.LAA02192@keep.lan.Awfulhak.org>
In-Reply-To: Your message of "Fri, 29 Jan 1999 00:12:49 PST." <199901290812.AAA38134@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> dillon      1999/01/29 00:12:49 PST
> 
>   Modified files:
>     sys/sys              kernel.h 
>   Log:
>       Commit a solution for the SYSINIT vs C_SYSINIT conundrum.  The
>       problem and solution is outlined in the comments, but basically
>       we needed a way to allow the SYSINIT mechanism to handle const void *
>       arguments and function pointers as well as non-const arguments and
>       function pointers while still maintaining the compiler's ability to
>       issue warnings if you try to use a bad combination.
>   
>   Revision  Changes    Path
>   1.52      +28 -20    src/sys/sys/kernel.h

A similar thing is the more fundamental problem with const - there's no 
way of declaring a function that accepts ``const something *'' and 
returns ``whatever was passed *''.

Does anyone know if gcc has an ``extension'' to deal with this ?  For 
example, the strchr() prototype is wrong because I can

  const char *donttouch;
  char dowhatyouwant;

  ....
  dowhatyouwant = strchr(donttouch, *donttouch);

The prototype is doubly wrong because there's no correct way to write
the function - not without casting the const char * to a char *.

-- 
Brian <brian@Awfulhak.org> <brian@FreeBSD.org> <brian@OpenBSD.org>
      <http://www.Awfulhak.org>;
Don't _EVER_ lose your sense of humour !



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901291118.LAA02192>