public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Does a pointer to function have a "Language Linkage"?
@ 2006-04-20  1:39 Perry Smith
  2006-04-20 11:39 ` John Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Perry Smith @ 2006-04-20  1:39 UTC (permalink / raw)
  To: MSX to GCC

The nut of this question: is

extern "C" void (*f)();

different from just

void (*f)();

?

It appears to me as if 7.5.8 says "yes" to this question -- they are  
different.

The details: The OS has timer facilities based in C and a C struct.   
The C struct has a pointer to function in it (a time pop routine).   
I've always assumed that this pointer to function must point to a  
function with C language linkage.  This sure becomes a pain though.

Thanks,
Perry

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

* Re: Does a pointer to function have a "Language Linkage"?
  2006-04-20  1:39 Does a pointer to function have a "Language Linkage"? Perry Smith
@ 2006-04-20 11:39 ` John Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: John Love-Jensen @ 2006-04-20 11:39 UTC (permalink / raw)
  To: Perry Smith, MSX to GCC

Hi Perry,

>Does a pointer to function have a "Language Linkage"?

I *THINK* (guessing) language linkage *CAN* affect three things:

1. name mangling
  "Do we prepend an underscore?
   Do we C++ mangle the name?
   Do we upper-case-ify?"

2. parameter order on stack
  "Are parameters pushed on left to right?
   Right to left?"

3. who cleans up the stack
  "Does the caller clean up the stack?
   Does the callee clean up the stack?"

For a function pointer, #1 is irrelevant.  #2 and #3 may be relevant,
depending on your platform.

I'm making a *GUESS* here, so I may be completely off base.

If I'm mistaken, I'd be happy to be corrected.

If I missed some, I'd be happy for those additional issues to be brought to
my attention.

HTH,
--Eljay

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

end of thread, other threads:[~2006-04-20 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-20  1:39 Does a pointer to function have a "Language Linkage"? Perry Smith
2006-04-20 11:39 ` John 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).