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


Groups > comp.lang.c > #8666

Re: offsetOf

From Phil Carmody <thefatphil_demunged@yahoo.co.uk>
Newsgroups comp.lang.c
Subject Re: offsetOf
Date 2011-07-24 18:25 +0300
Organization A noiseless patient Spider
Message-ID <87k4b7puow.fsf@bazspaz.fatphil.org> (permalink)
References <pan.2011.07.23.20.54.51@mailinator.com> <0.500382f6e840bc7bfed7.20110723230357BST.871uxgu01e.fsf@bsb.me.uk> <87y5zoork3.fsf@bazspaz.fatphil.org> <0.4d6e4d5a20933c7e70e3.20110724125050BST.87vcursxr9.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes:
> 
> > Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> >> Jack Boot <jackboot@mailinator.com> writes:
> <snip>
> >> > struct foo {
> >> >   int a[10];
> >> >   long b;
> >> >   ...
> >> > };
> <snip>
> >> > void
> >> > bar ( struct foo * f )
> >> > {
> <snip>
> >> > }
> <snip>
> >>   int *ip = f->a;
> >
> > I have this fetish for wanting addresses to explicitly be addresses
> > (the result of applying the 'address of' operator), so my default 
> > would be that which explicitly says 'the address of the first element':
> >
> >   int *ip = &f->a[0];
> >
> > I'm consistent with this,
> 
> How many of these are there in your code:
> 
>   const char *digits = &"0123456789"[0];
>   ...
>   strcmp(&"string"[0], str) == 0

A pair of '"'s is another clear indicator, so precisely zero.

Phil
-- 
"At least you know where you are with Microsoft."
"True. I just wish I'd brought a paddle." -- Matthew Vernon

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

offsetOf Jack Boot <jackboot@mailinator.com> - 2011-07-23 20:54 +0000
  Re: offsetOf Ian Collins <ian-news@hotmail.com> - 2011-07-24 09:05 +1200
  Re: offsetOf Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-23 23:03 +0100
    Re: offsetOf Jack Boot <jackboot@mailinator.com> - 2011-07-24 10:30 +0000
      Re: offsetOf Ian Collins <ian-news@hotmail.com> - 2011-07-24 22:41 +1200
      Re: offsetOf James Kuyper <jameskuyper@verizon.net> - 2011-07-24 08:36 -0400
      Re: offsetOf jt@toerring.de (Jens Thoms Toerring) - 2011-07-24 14:50 +0000
      Re: offsetOf Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-07-24 10:28 -0600
      Re: offsetOf Nobody <nobody@nowhere.com> - 2011-07-24 17:30 +0100
      Re: offsetOf gordonb.gkpc8@burditt.org (Gordon Burditt) - 2011-07-27 08:43 -0500
    Re: offsetOf Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-24 14:18 +0300
      Re: offsetOf Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-24 12:50 +0100
        Re: offsetOf Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-24 18:25 +0300
  Re: offsetOf Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-23 20:12 -0400
  Re: offsetOf "J. J. Farrell" <jjf@bcs.org.uk> - 2011-07-24 01:57 +0100

csiph-web