Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: configure() -- a new C compiler preprocessor and code injection proposal |
| Date | 2015-09-01 08:12 -0700 |
| Organization | None to speak of |
| Message-ID | <ln4mjetbq4.fsf@kst-u.example.com> (permalink) |
| References | (6 earlier) <lnmvxhzodm.fsf@kst-u.example.com> <ms22ja$26f$1@speranza.aioe.org> <lnd1y3tj1y.fsf@kst-u.example.com> <378d561b-d273-423b-aedc-9e26bcc25102@googlegroups.com> <ms3mc8$dkv$1@dont-email.me> |
David Brown <david.brown@hesbynett.no> writes:
[...]
>> On Monday, August 31, 2015 at 2:22:12 PM UTC-4, Keith Thompson wrote:
>>> How would you implement offsetof() without using a macro?
>>>
>>> offsetof (defined in <stddef>) takes two arguments, a type name and a
>>> member name. For example:
>>>
>>> struct foo {
>>> int x;
>>> int y;
>>> };
>>>
>>> offsetof(struct foo, x) == 0
>>> offsetof(struct foo, y) == sizeof (int) (most likely)
[...]
> You would need casts to integer types here:
>
> int lnOffsetX = ((uintptr_t) &foo.x - (uintptr_t) &foo);
No, that would not work portably. It assumes that uintptr_t
exists, which is not guaranteed (there might not be any unsigned
integer type wide enough to hold a converted pointer value without
loss of information). And it assumes that arithmetic on uintptr_t
corresponds to arithmetic on pointers, which also is not guaranteed
-- and I've worked on systems where it doesn't.
Casting to char rather than to uintptr_t would work, except that ...
> Of course, that requires the existence of an object "foo" of the struct
> type - while offsetoff works /without/ having any known object of that type.
[...]
--
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"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-21 08:27 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-21 20:15 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-21 20:25 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-21 20:34 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 09:46 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Philip Lantz <prl@canterey.us> - 2015-08-22 13:15 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal fir <profesor.fir@gmail.com> - 2015-08-22 13:25 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ian Collins <ian-news@hotmail.com> - 2015-08-23 09:06 +1200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 14:47 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-22 23:09 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 15:21 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.qvmey@burditt.org (Gordon Burditt) - 2015-08-23 17:21 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 16:53 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.bkbkd@burditt.org (Gordon Burditt) - 2015-08-23 19:44 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 19:08 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.rnzzf@burditt.org (Gordon Burditt) - 2015-08-23 22:29 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 20:43 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.594yb@burditt.org (Gordon Burditt) - 2015-08-24 07:09 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 05:30 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Gordon Burditt <gordon@hammy.burditt.org> - 2015-08-24 07:39 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 05:43 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Kleinecke <dkleinecke@gmail.com> - 2015-08-24 18:11 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 03:18 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-25 14:31 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 05:36 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Richard Damon <Richard@Damon-Family.org> - 2015-08-24 22:01 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 03:22 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-25 12:12 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 04:26 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-25 13:09 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 05:20 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-25 13:50 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 06:08 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal gazelle@shell.xmission.com (Kenny McCormack) - 2015-08-25 14:34 +0000
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 07:53 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal jt@toerring.de (Jens Thoms Toerring) - 2015-08-25 12:53 +0000
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 06:19 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-25 15:47 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 07:23 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-25 16:41 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 08:08 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 05:54 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-24 09:17 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal gazelle@shell.xmission.com (Kenny McCormack) - 2015-08-22 22:22 +0000
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 15:31 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-23 23:13 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal fir <profesor.fir@gmail.com> - 2015-08-22 15:40 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 16:00 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal fir <profesor.fir@gmail.com> - 2015-08-22 16:05 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ian Collins <ian-news@hotmail.com> - 2015-08-23 11:07 +1200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 16:15 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 15:01 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-22 23:16 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 15:24 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.i2ffz@burditt.org (Gordon Burditt) - 2015-08-22 17:40 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 15:55 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ian Collins <ian-news@hotmail.com> - 2015-08-23 11:13 +1200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 16:19 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-22 16:29 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Richard Damon <Richard@Damon-Family.org> - 2015-08-22 21:04 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.501pe@burditt.org (Gordon Burditt) - 2015-08-23 18:25 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 17:18 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 10:41 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-23 22:55 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.ca5vg@burditt.org (Gordon Burditt) - 2015-08-23 18:43 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 10:57 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 05:40 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 15:07 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 06:29 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 15:56 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 07:18 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 17:22 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-24 14:36 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-24 06:49 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-08-23 12:55 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 04:58 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-23 13:03 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 05:20 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 16:59 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 09:34 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 20:10 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal gazelle@shell.xmission.com (Kenny McCormack) - 2015-08-23 16:36 +0000
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-08-23 14:27 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-23 13:35 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-08-23 15:08 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Keith Thompson <kst-u@mib.org> - 2015-08-23 14:27 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-08-31 19:24 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-08-31 13:53 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-08-31 19:59 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-31 19:10 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal Keith Thompson <kst-u@mib.org> - 2015-08-31 11:27 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-08-31 15:40 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal Keith Thompson <kst-u@mib.org> - 2015-08-31 11:22 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-31 12:18 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-09-01 10:09 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Keith Thompson <kst-u@mib.org> - 2015-09-01 08:12 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-09-01 22:19 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-06 14:47 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-23 23:13 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-08-31 22:27 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal supercat@casperkitty.com - 2015-08-31 15:00 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-09-01 00:56 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-08-31 20:11 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-09-01 12:26 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-09-01 13:37 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-09-01 22:18 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-09-01 16:31 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-09-04 07:15 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-09-04 07:28 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-08-31 20:02 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-09-01 09:41 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-09-01 12:24 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-09-01 14:14 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Morten W. Petersen" <morphex@gmail.com> - 2015-09-04 07:22 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-09-04 07:38 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-01 13:14 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal James Kuyper <jameskuyper@verizon.net> - 2015-09-01 11:07 -0400
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.vg6n6@burditt.org (Gordon Burditt) - 2015-08-23 19:29 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-24 09:32 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 11:43 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-24 11:01 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 12:24 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-24 12:06 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal David Brown <david.brown@hesbynett.no> - 2015-08-24 14:21 +0200
Re: configure() -- a new C compiler preprocessor and code injection proposal Ian Collins <ian-news@hotmail.com> - 2015-08-24 07:48 +1200
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 12:56 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 13:45 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-23 14:38 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 06:43 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-23 15:00 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 07:54 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 19:28 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal mark.bluemel@gmail.com - 2015-08-24 00:31 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 16:17 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal Bartc <bc@freeuk.com> - 2015-08-23 16:30 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 19:44 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-23 06:40 -0700
Re: configure() -- a new C compiler preprocessor and code injection proposal Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-23 16:29 +0100
Re: configure() -- a new C compiler preprocessor and code injection proposal gordonb.kj6kb@burditt.org (Gordon Burditt) - 2015-08-23 19:13 -0500
Re: configure() -- a new C compiler preprocessor and code injection proposal "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-04 05:10 -0700
csiph-web