Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #168296
| From | Kaz Kylheku <864-117-4973@kylheku.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: complex problem with gcc usage |
| Date | 2022-11-19 21:42 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20221119133720.596@kylheku.com> (permalink) |
| References | <tl8eo4$2vpv0$1@dont-email.me> <20221118115253.118@kylheku.com> <tla4vb$36ma1$1@dont-email.me> <tlb6ns$398db$1@dont-email.me> |
On 2022-11-19, aotto1968 <aotto1968@t-online.de> wrote:
>
> This works for "C" and "C++" but I'll not use this, because…
>
> /// cast a \e known-object into an \RMkNs{ObjectS} reference
> #define MkOBJ_R(x) (*(x)).super.obj
> /// cast a \e known-object into an \RMkNs{ObjectS} pointer
> #define MkOBJ(x) ((sizeof(*(x)) == sizeof(struct MkObjectS)) ? ((MK_OBJ)(x)) : &(*(x)).super.obj)
>
> 1. it does NOT work for reference
> 2. require HARD cast for success → this break compile-time-type-safty
> 3. "sizeof" as indicator is to "slippy" because unequal types COULD still have same size (alignment-problem)
It could be used as a fallback for compiling with a C implementation
speaking a dialect before before C11 (no _Generic).
You just don't catch those errors when building that way; but if that's
not what you mainly develop with, it doesn't matter.
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
complex problem with gcc usage aotto1968 <aotto1968@t-online.de> - 2022-11-18 18:17 +0100
Re: complex problem with gcc usage Kaz Kylheku <864-117-4973@kylheku.com> - 2022-11-18 20:03 +0000
Re: complex problem with gcc usage aotto1968 <aotto1968@t-online.de> - 2022-11-19 09:43 +0100
Re: complex problem with gcc usage Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-11-19 14:39 +0000
Re: complex problem with gcc usage Kaz Kylheku <864-117-4973@kylheku.com> - 2022-11-19 16:13 +0000
Re: complex problem with gcc usage aotto1968 <aotto1968@t-online.de> - 2022-11-19 19:19 +0100
Re: complex problem with gcc usage Kaz Kylheku <864-117-4973@kylheku.com> - 2022-11-19 21:42 +0000
Re: complex problem with gcc usage Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-11-19 14:34 -0800
Re: complex problem with gcc usage aotto1968 <aotto1968@t-online.de> - 2022-11-20 08:40 +0100
Re: complex problem with gcc usage Kaz Kylheku <864-117-4973@kylheku.com> - 2022-11-20 15:09 +0000
Re: complex problem with gcc usage "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-11-18 12:10 -0800
csiph-web