chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] New dimensions in ABI design braindamage


From: John Cowan
Subject: Re: [Chicken-hackers] New dimensions in ABI design braindamage
Date: Wed, 8 Jul 2015 20:14:15 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

address@hidden scripsit:

> a function ptr of type
> 
>   typedef void (*C_proc4)(C_word, C_word, C_word, C_word, C_word)
> 
> that points to a function of (say) this type
> 
>   void myproc(C_word c, C_word k, C_word a1, ...)
> 
> will break, 

Yes.  That's undefined behavior according to the C standard, and if it happens
to work when compiled with gcc on i386 and x86_64, that's just good luck.

> I'm out of my wits. This is extremely stupid and breaks every attempt at 
> implementing generic function-pointers in C without paying a massive 
> performance penalty. 

C really doesn't have any generic function pointers.  If the numbers
and types of the arguments, and the presence or absence of '...', don't
match as between the function pointer and the pointee, then the pointee
can't count on where to find its arguments.

-- 
John Cowan          http://www.ccil.org/~cowan        address@hidden
Ambassador Trentino: I've said enough. I'm a man of few words.
Rufus T. Firefly: I'm a man of one word: scram!    --Duck Soup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]