delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/24/20:02:58

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp,comp.lang.c
Subject: Re: Functions in struct's... possible? How?
Date: Sun, 24 Aug 1997 14:12:23 -0700
Organization: Alcyone Systems
Lines: 23
Message-ID: <3400A3B7.2A2A2218@alcyone.com>
References: <33FCDA5C DOT 2353659F AT execulink DOT com> <5tjgve$buu$1 AT narses DOT hrz DOT tu-chemnitz DOT de>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hans Steffani wrote:

>  structure[0].funk();           /* funktion1 called via pointer  */
>                    /* ANSI-C                        */
> 
>  (*structure[1].funk)();        /* funktion2 called via pointer  */
>                    /* ANSI-C und K&R-C              */

Both of these calls are completely valid ANSI C.  In fact, dereferencing
a function pointer before calling it is completely redudnant now.  YOu
can even do it as many times as you like:

    (************structure[1].funk)();

Bad style, but completely legal.

-- 
          Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                        Alcyone Systems / http://www.alcyone.com/max/
   San Jose, California, United States / icbm://37.20.07n/121.53.38w
                                      \
                  "War is like love; / it always finds a way."
                                    / Bertolt Brecht

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019