Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!voder!pyramid!octopus!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.std.c++ Subject: Re: Proposed: "closures" Keywords: proposal, closures, function pointers Message-ID: <1991May10.003304.12390@mathcs.sjsu.edu> Date: 10 May 91 00:33:04 GMT References: <1991Apr26.023303.12141@kestrel.edu> <1991Apr28.231328.2064@world.std.com> <1991Apr30.201532.13706@kestrel.edu> Distribution: comp.std.c++ Organization: San Jose State University - Math/CS Dept. Lines: 36 In article <1991Apr30.201532.13706@kestrel.edu> gyro@kestrel.edu (Scott Layson Burson) writes: > >But it doesn't matter -- I've been chatting with Jerry Schwartz about >this, and it turns out he has already made a suggestion along rather >different lines (in document X3J16/91-0011), which is to treat `extern >"C"' as though it were part of the type of the function or function >pointer; so there would be a distinction between > > extern "C" void (*f)(); > >and > > void (*f)(); > >I like this a lot: the ugliness of the solution is exactly symmetrical >with the ugliness of the problem, which to me is the definition of an >elegant solution. Good. This is pretty important stuff on DOS machines (and probably on others) that use a "Pascal" calling convention for C++ functions and a C calling convention for (you guessed it) C functions. And it really shows the bankrupcy of the C style declaration syntax that jumbles up - the name of the object to be declared - its type - its storage class in a hopeless way. Just out of curiosity: Suppose I have a variable f that holds a pointer to a "C" style void->void function and I want to make f local to its source file, do I say static extern "C" void (*f)(); Cay