Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #43558 > unrolled thread

quick question. Am I reading this right?

Started byhalfmaddad@gmail.com
First post2014-04-25 08:00 -0700
Last post2014-04-25 08:46 -0700
Articles 5 — 4 participants

Back to article view | Back to comp.lang.c


Contents

  quick question. Am I reading this right? halfmaddad@gmail.com - 2014-04-25 08:00 -0700
    Re: quick question. Am I reading this right? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-04-25 17:24 +0200
    Re: quick question. Am I reading this right? James Kuyper <jameskuyper@verizon.net> - 2014-04-25 11:25 -0400
      Re: quick question. Am I reading this right? halfmaddad@gmail.com - 2014-04-25 08:37 -0700
    Re: quick question. Am I reading this right? Keith Thompson <kst-u@mib.org> - 2014-04-25 08:46 -0700

#43558 — quick question. Am I reading this right?

Fromhalfmaddad@gmail.com
Date2014-04-25 08:00 -0700
Subjectquick question. Am I reading this right?
Message-ID<26357b8d-451e-40ae-9b14-61f8ea5b1834@googlegroups.com>
Hi Everyone

I have encountered this snippet of code:
 screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

Is this correct, the results from xcb_get_setup are fed to xcb_setup_roots_iterator and the result from this is a struct. And this struct's "data" member is then assigned to screen ?

Thanks for reading-Patrick

[toc] | [next] | [standalone]


#43560

FromAlain Ketterlin <alain@dpt-info.u-strasbg.fr>
Date2014-04-25 17:24 +0200
Message-ID<87eh0l77px.fsf@dpt-info.u-strasbg.fr>
In reply to#43558
halfmaddad@gmail.com writes:

> I have encountered this snippet of code:
>  screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
>
> Is this correct, the results from xcb_get_setup are fed to
> xcb_setup_roots_iterator and the result from this is a struct. And
> this struct's "data" member is then assigned to screen ?

Exactly. More precisely: the result from xcb_get_setup [of type
"const xcb_setup_t *"] are fed to xcb_setup_roots_iterator and the
result from this is a struct [of type "xcb_screen_iterator_t"]. And this
struct's "data" member [of type "xcb_screen_t *"] is then assigned to
screen ?

Here are the relevant declarations from xcb.h and xproto.h
(in /usr/include/xcb on my box), both being fairly well documented:

const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);

xcb_screen_iterator_t xcb_setup_roots_iterator (const xcb_setup_t *R);

typedef struct xcb_screen_iterator_t {
    xcb_screen_t *data;
    int           rem;
    int           index;
} xcb_screen_iterator_t;

-- Alain.

[toc] | [prev] | [next] | [standalone]


#43561

FromJames Kuyper <jameskuyper@verizon.net>
Date2014-04-25 11:25 -0400
Message-ID<535A7E67.9050406@verizon.net>
In reply to#43558
On 04/25/2014 11:00 AM, halfmaddad@gmail.com wrote:
> Hi Everyone
> 
> I have encountered this snippet of code:
>  screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
> 
> Is this correct, the results from xcb_get_setup are fed to xcb_setup_roots_iterator and the result from this is a struct. And this struct's "data" member is then assigned to screen ?

Yes.

[toc] | [prev] | [next] | [standalone]


#43563

Fromhalfmaddad@gmail.com
Date2014-04-25 08:37 -0700
Message-ID<5ca0545b-a6ae-41f8-88c7-99688188900d@googlegroups.com>
In reply to#43561
thanks Alain ! Thanks James !

Have a great day

[toc] | [prev] | [next] | [standalone]


#43566

FromKeith Thompson <kst-u@mib.org>
Date2014-04-25 08:46 -0700
Message-ID<ln1twltns8.fsf@nuthaus.mib.org>
In reply to#43558
halfmaddad@gmail.com writes:
> I have encountered this snippet of code:
>  screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
>
> Is this correct, the results from xcb_get_setup are fed to
> xcb_setup_roots_iterator and the result from this is a struct. And
> this struct's "data" member is then assigned to screen ?

Yes.  (It's conceivable, but unlikely, that xcb_setup_roots_iterator()
returns a union rather than a struct.)

My only quibble is that I'd say "result" rather than "results".

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web