home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!pipex!warwick!bham!bhamvx!mccauleyba
- From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
- Subject: Re: Declaration Syntax Error
- Sender: usenet@rs6000.bham.ac.uk (USENET News Service)
- Message-ID: <1992Nov8.100412.1@vax1.bham.ac.uk>
- Date: Sun, 8 Nov 1992 10:04:12 GMT
- Lines: 30
- References: <trumpet-user.1.721149008@csc.cuhk.hk>
- Organization: University of Birmingham
-
- In article <trumpet-user.1.721149008@csc.cuhk.hk>, trumpet-user@csc.cuhk.hk (Default Trumpet User) writes:
- > Could someone tell me why I got the captioned error message once I declared
- > the following function:
- >
- > int (*abcd) (int i)
- > {
- > ...
- > }
- Yes because abcd is not a function, it's a pointer to a function and you're not
- allowed to initialise a pointer to a function to an anonymous function in C++.
-
- What you meant is either :
- static int anon_func (int i) { ... }
- int (*abcd) (int i) = anon_func;
- which makes abcd point to a static function which is the nearest thing you get
- to an anonymous function in C++
-
- Or more likely:
- int *abcd(int i) {...}
- which makes abcd a function returning a pointer to an integer
-
- Please mail me as I'm not sure that my postings are gettimg out of our news
- server.
-
- \\ ( ) NO BULLSHIT! from BAM (Brian McCauley)
- . _\\__[oo
- .__/ \\ /\@ E-mail: B.A.McCauley@bham.ac.uk
- . l___\\ Fax: +44 21 625 2175
- # ll l\\ Snail: 197 Harborne Lane, Birmingham, B29 6SS, UK
- ###LL LL\\ ICBM: 52.5N 1.9W
-