Re: Problem with function pointers and structures

Discussion in 'C Programming' started by Eric Sosman, Jul 2, 2009.

  1. Eric Sosman

    Eric Sosman Guest

    Simon Connah wrote:
    > On 2009-07-02 20:39:54 +0100, Simon Connah <>
    > said:
    >
    >> typedef struct user
    >> {
    >> char *username;
    >> char *password;
    >>
    >> /* lots more... omitted for brevity */
    >>
    >> struct user *interface;
    >> }

    >
    > Oops this should read:
    >
    > typedef struct user
    > {
    > char *username;
    > char *password;
    >
    > /* lots more... omitted for brevity */
    >
    > struct user *interface;
    > } user;


    ITYM it should read

    typedef struct user {
    /* omitted for brevity */
    user_interface *interface;
    } user;

    .... on the assumption that eventually you'll do things like

    PGconn conn = ...;
    user *ptr = ...;
    ptr->interface->add(&conn, ptr);

    See also "Poor Man's Object-Oriented C."

    --
    Eric Sosman
    lid
    Eric Sosman, Jul 2, 2009
    #1
    1. Advertising

  2. Eric Sosman

    luserXtrog Guest

    On Jul 2, 3:33 pm, Eric Sosman <> wrote:

    <snipperoo!>

    > See also "Poor Man's Object-Oriented C."


    I'm not finding anything by that name. Is this the precise title?

    --
    lxt
    luserXtrog, Jul 4, 2009
    #2
    1. Advertising

  3. Eric Sosman

    Nobody Guest

    On Fri, 03 Jul 2009 22:26:46 -0700, luserXtrog wrote:

    >> See also "Poor Man's Object-Oriented C."

    >
    > I'm not finding anything by that name. Is this the precise title?


    I don't think that he meant the "see also" literally.
    Nobody, Jul 4, 2009
    #3
  4. Eric Sosman

    Eric Sosman Guest

    luserXtrog wrote:
    > On Jul 2, 3:33 pm, Eric Sosman <> wrote:
    >
    > <snipperoo!>
    >
    >> See also "Poor Man's Object-Oriented C."

    >
    > I'm not finding anything by that name. Is this the precise title?


    No; fuzzy searching is called for. That was the phrase I
    recall hearing back in the days when C++ was only spottily
    available and when every system that had C++ had its very own
    dialect (and when I worked on a 2.7Mloc O-O C program).

    --
    Eric Sosman
    lid
    Eric Sosman, Jul 4, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tweak
    Replies:
    14
    Views:
    2,766
    Eric Sosman
    Jun 11, 2004
  2. Alfonso Morra
    Replies:
    11
    Views:
    703
    Emmanuel Delahaye
    Sep 24, 2005
  3. Jens Thoms Toerring

    Re: Problem with function pointers and structures

    Jens Thoms Toerring, Jul 2, 2009, in forum: C Programming
    Replies:
    7
    Views:
    330
    Richard Bos
    Jul 4, 2009
  4. jameskuyper

    Re: Problem with function pointers and structures

    jameskuyper, Jul 8, 2009, in forum: C Programming
    Replies:
    2
    Views:
    288
    jameskuyper
    Jul 9, 2009
  5. cerr

    pointers, pointers, pointers...

    cerr, Apr 7, 2011, in forum: C Programming
    Replies:
    12
    Views:
    656
Loading...

Share This Page