🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1090

Re: Proposed: "closures"

#1090
From: Benjamin Schreiber
Date: Sun, 12 May 1991 19:42
30 lines
1670 bytes
In article <1991May10.003304.12390@mathcs.sjsu.edu> horstman@mathcs.sjsu.edu (Cay Horstmann) writes:
>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

What you proposed is not syntacticly valid.
From reading the grammar, I get the feeling that the correct way to do this
is:

extern "C" {
  static void (*f)();
};

Since any declarations/definitions are gramaticly allowed inside an extern
construct.  The following may also be valid:

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

I don't know whether current implementations support this (I have nothing
to test this on), but they should.  Another use for this flexibility might
be to provide a way to define resources for the Macintosh within the C++
source (i.e. extern "resource ICON,128" {....}).  Just a thought.
(Note: I am refering to AT&T 2.1, not ARM)

	-- Ben Schreiber
	   bs@cs.brandeis.edu
Technical Details
Message-ID: <1991May12.194247.21483@news.cs.brandeis.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!uwm.edu!bbn.com!nic!news.cs.brandeis.edu!chaos.cs.brandeis.edu!bs
References: <1991Apr28.231328.2064@world.std.com> <1991Apr30.201532.13706@kestrel.edu> <1991May10.003304.12390@mathcs.sjsu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!uwm.edu!bbn.com!nic!news.cs.brandeis.edu!chaos.cs.brandeis.edu!bs
From: bs@chaos.cs.brandeis.edu (Benjamin Schreiber)
Newsgroups: comp.std.c++
Subject: Re: Proposed: "closures"
Keywords: proposal, closures, function pointers
Message-ID: <1991May12.194247.21483@news.cs.brandeis.edu>
Date: 12 May 91 19:42:47 GMT
References: <1991Apr28.231328.2064@world.std.com> <1991Apr30.201532.13706@kestrel.edu> <1991May10.003304.12390@mathcs.sjsu.edu>
Sender: usenet@news.cs.brandeis.edu
Distribution: comp.std.c++
Organization: Brandeis University
Lines: 30