httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <dgaudet-list-new-ht...@arctic.org>
Subject Re: cvs commit: httpd-2.0/modules/filters mod_include.c
Date Sun, 07 Jan 2001 20:37:48 GMT
that's void (*)() ... got to get the bracketing right :)

note that it's even conceivable that void (*)(), void (*)(int) and void
(*)(int, ...)  are different pointer sizes.  but i've yet to encounter an
architecture like that...

typically those can result in completely different calling conventions.
a fixed argument function can use registers for some arguments, for
example.  whereas varargs functions essentially have to pass args on the
stack (weirdo architectures like hobbit notwithstanding :).

for example if you cast a varargs function to void (*)(int) and then
called it that way you would generate bad code on some architectures.
MSVC fastcall conventions for example use registers.  (there's also
bizarre push-left-to-right and right-to-left differences under windows,
having to do with the pascal calling convention legacy... which is what
leads to the differences in how you declare varargs versus fixed args
functions for dlls.)

the only time the void (*)() thing is a pain is if you want to do pointer
arithmetic... which isn't really defined for functions at all.  if you're
doing arithmetic to generate a hash or something then you may want a
config time test which calculates the smallest integer type which holds a
function pointer, and bail out if one can't be found.

-dean

On Sun, 7 Jan 2001 rbb@covalent.net wrote:

>
> > > If by chance you mean that the sentence beginning with "void" is
> > > factually incorrect according to published standards, I'd like to
> > > know, as I'll contact the OS/390 compiler folks and see what they can
> > > do.  (I'll punt on Tru64 as I don't know how issues like this are
> > > handled.)
> >
> > [ actually, it *is* potentially a problem if a func ptr can't fit in a
> >   void*; that means the hash table is simply broken on some platforms ]
>
> Yeah, but it is an easy fix.  Dean said that (void *)() is always a valid
> func ptr, so we just need to use that instead of void *.
>
> Ryan
>
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
>
>


Mime
View raw message