C Struct question

From: Michael Ingram (NOme_ingramSPAM_at_earthlink.net)
Date: 01/30/04


Date: Fri, 30 Jan 2004 05:15:35 GMT

Can anyone explain how these c struct elements are hidden?
Is it file scope of the struct, typedef,...?

Thanks,
Mike

/**************************************************/
/* screen.c
*/
/*
*/
/**************************************************/
struct _screen
{
   int transparent;
   int ncolors;
   o_color_def * colors;
   ID focus;
}

void set_screen( screen *new )
{
   O_gadget_set_focus( new->focus );
}

/**************************************************/
/* screen.h
*/
/*
*/
/**************************************************/

typedef struct _screen screen;

/**************************************************/
/* state.c
*/
/*
*/
/**************************************************/
#include "screen.h"

static void some_state_function(ID screen_id)
{
  screen *screen;

  /* this returns an O_gadget pointer, but see below */
  screen = O_gadget_new_from_resource(screen_id);

    /* THIS LINE WON'T COMPILE */
  O_gadget_set_focus( screen->focus); -> dereferncing pointer to incomplete
type

  /* BUT THIS WORKS FINE*/
  set_screen( screen );
}



Relevant Pages

  • [2.6 patch] misc drivers/char/ cleanups
    ... +static int __init espserial_init ... +static struct work_struct genrtc_task; ... -i2cmdSetSeq(unsigned char type, unsigned char size, unsigned char *string) ... static void set_params; ...
    (Linux-Kernel)
  • [GIT PULL] perfcounters for v2.6.32, part 2
    ... Use a define for the maximum length of a trace event ... Rename struct lat_snapshot to struct work atoms ... unsigned int i; ... static void mwait_idle ...
    (Linux-Kernel)
  • [RFC] mmiotrace full patch, preview 2
    ... mmiotrace module. ... +struct kmmio_fault_page { ... * GNU General Public License for more details. ... +static void post(struct kmmio_probe *p, unsigned long condition, ...
    (Linux-Kernel)
  • [2.6 patch] misc drivers/char/ cleanups (fwd)
    ... +static int __init espserial_init ... +static struct work_struct genrtc_task; ... -i2cmdSetSeq(unsigned char type, unsigned char size, unsigned char *string) ... static void set_params; ...
    (Linux-Kernel)
  • [2.6 patch] drivers/char/: misc cleanups
    ... +static int __init espserial_init ... +static struct work_struct genrtc_task; ... -i2cmdSetSeq(unsigned char type, unsigned char size, unsigned char *string) ... static void set_params; ...
    (Linux-Kernel)