home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:20123 vmsnet.alpha:137 cern.alpha:30
- Newsgroups: comp.lang.c,vmsnet.alpha,cern.alpha
- Path: sparky!uunet!spool.mu.edu!agate!overload.lbl.gov!dxcern!burow
- From: burow@dxcern.cern.ch (Burkhard Burow)
- Subject: function arg.'s in Alpha's DEC C
- Message-ID: <1993Jan23.194139.17196@dxcern.cern.ch>
- Organization: CERN European Laboratory for Particle Physics
- Date: Sat, 23 Jan 1993 19:41:39 GMT
- Lines: 40
-
-
- I'm having trouble passing functions as arguments on an Alpha running VMS and
- 'DEC C for OpenVMS AXP V1.2-000'
-
- My application generates 'wrapper' routines which pass along functions to
- other routines. The wrapper routines do not know the type of the functions they
- are passing along.
-
- Simplified e.g.
-
- void q ( int (*c)() ); /* A. prototype of q */
-
- void __q( void ( *a)() ) /* B. function with a function as argument */
- {
- q( a ); /* C. pass the function parameter on to q. */
- }
-
- For which the C compiler complains:
-
- q( a );
- ^
- %CC-E-PASNOTREFCOM, In this statement, the referenced type of the pointer value
- "a" is "Function (...) returning void", which is not compatible with "Function (
- ...) returning signed int".
- at line number 5
-
-
- Silicon Graphics 2.0.1 ANSI generates a similar warning, but can be satisfied
- by casting 'a' in line B. as follows:
-
- q( *(void **)&a );
-
- Other compilers swallow line B. as is.
-
- QQQuestion: How do I force DEC C to accept line B.
- i.e. How do I cast the parameter 'a', such that it is acceptable
- as a an argument for any type of function?
-
- thanks,
- burkhard burow@vxdesy.cern.ch
-