Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A woman should have compassion. -- Kirk, "Catspaw", stardate 3018.2


devel / comp.lang.c / typeof and function pointer

SubjectAuthor
* typeof and function pointeraotto1968
+- Re: typeof and function pointerBonita Montero
+* Re: typeof and function pointerStefan Ram
|`* Re: typeof and function pointerKaz Kylheku
| `- Re: typeof and function pointerBen
+* Re: typeof and function pointerThiago Adams
|`- Re: typeof and function pointerThiago Adams
`* Re: typeof and function pointerTim Rentsch
 `- Re: typeof and function pointeraotto1968

1
typeof and function pointer

<t7f5se$guh$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21825&group=comp.lang.c#21825

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: aotto1...@t-online.de (aotto1968)
Newsgroups: comp.lang.c
Subject: typeof and function pointer
Date: Sat, 4 Jun 2022 10:41:50 +0200
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <t7f5se$guh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 4 Jun 2022 08:41:50 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="64348a6f12ffa6a1be52b54298842362";
logging-data="17361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hM09cCR2JUqJw6+YwPk3tc51AWSKYAnY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:QpaOQ9RjODo3bzLyH1RXxf24wog=
Content-Language: en-US
 by: aotto1968 - Sat, 4 Jun 2022 08:41 UTC

Hi, I have an function pointer, example:

typedef bool (*MkErrorResetOnExitF) (MK_EXTENSION_ARGS, MK_OBJ const fmtobj)

and I want to use the *return* type of the function pointer in a macro,
example:

#define MkWalkErrExtReturn(_err, _fct, ...) ({ \
typeof(_fct) ret = 0; \
if (_err->mkerrext) { \

MK_EXT ext, head=MkEXT(_err->mkerrext); \

DL_FOREACH(head,ext) { \

MK_ERREXT errext = MkErrExt(ext); \

if (errext && errext->_fct) { \

ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__); \

if (ret) break; \

} \

} \

} \

ret; \

})

used in:

> if (MkWalkErrExtReturn(err, fErrorResetOnExit, fmtobj)) return;

the problem is that:

> typeof(_fct) = typeof(fErrorResetOnExit)

return the type of the entire function pointer and *not* the type of the
function pointer return.

question: it is possible to get in C (gcc) the return typ of a function
pointer with some "typeof" extension?

mfg

Re: typeof and function pointer

<t7f93e$db6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21826&group=comp.lang.c#21826

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c
Subject: Re: typeof and function pointer
Date: Sat, 4 Jun 2022 11:37:02 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <t7f93e$db6$1@dont-email.me>
References: <t7f5se$guh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 4 Jun 2022 09:36:46 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e8f921e63e2a65d273434b93321327c6";
logging-data="13670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SgdqiozLzhZxs2DSZsgLVmlsWSY6jnQw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:yYsuOeZIS0IRlCMJhfP8vw1PpN8=
In-Reply-To: <t7f5se$guh$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Sat, 4 Jun 2022 09:37 UTC

Am 04.06.2022 um 10:41 schrieb aotto1968:

> #define MkWalkErrExtReturn(_err, _fct, ...) ({                 \
>   typeof(_fct) ret = 0;                        \
>   if (_err->mkerrext) {                                        \
>     MK_EXT ext, head=MkEXT(_err->mkerrext);                    \
>     DL_FOREACH(head,ext) {                                     \
>       MK_ERREXT errext = MkErrExt(ext);                        \
>       if (errext && errext->_fct) {                            \
>         ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__);   \
>         if (ret) break;                                        \
>       }                                                        \
>     }                                                          \
>   }                                                            \
>   ret;                                                         \
> })

Disgusting.

Re: typeof and function pointer

<typeof-20220604132200@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21827&group=comp.lang.c#21827

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.c
Subject: Re: typeof and function pointer
Date: 4 Jun 2022 12:22:26 GMT
Organization: Stefan Ram
Lines: 10
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <typeof-20220604132200@ram.dialup.fu-berlin.de>
References: <t7f5se$guh$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de FTsX4g7Je3V23rwQ9D2COg9YSescka79zvBmy/3KEgX7wb
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Sat, 4 Jun 2022 12:22 UTC

aotto1968 <aotto1968@t-online.de> writes:
>question: it is possible to get in C (gcc) the return typ of a function
>pointer with some "typeof" extension?

#include <stdio.h>

int main( void )
{ char f(); printf( "%d\n", ( int )( sizeof( typeof( f() )))); }

Re: typeof and function pointer

<d8844912-5312-4292-b4d9-4a0cc124212fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21828&group=comp.lang.c#21828

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:19c9:b0:464:6a91:2ec5 with SMTP id j9-20020a05621419c900b004646a912ec5mr15452663qvc.39.1654348009373;
Sat, 04 Jun 2022 06:06:49 -0700 (PDT)
X-Received: by 2002:ac8:5904:0:b0:304:e480:ce04 with SMTP id
4-20020ac85904000000b00304e480ce04mr3265696qty.77.1654348009184; Sat, 04 Jun
2022 06:06:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sat, 4 Jun 2022 06:06:48 -0700 (PDT)
In-Reply-To: <t7f5se$guh$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2804:14d:4c84:9eab:2df2:dd40:b42a:64b8;
posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 2804:14d:4c84:9eab:2df2:dd40:b42a:64b8
References: <t7f5se$guh$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d8844912-5312-4292-b4d9-4a0cc124212fn@googlegroups.com>
Subject: Re: typeof and function pointer
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Sat, 04 Jun 2022 13:06:49 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Thiago Adams - Sat, 4 Jun 2022 13:06 UTC

On Saturday, June 4, 2022 at 5:42:06 AM UTC-3, aotto1968 wrote:
> Hi, I have an function pointer, example:
>
> typedef bool (*MkErrorResetOnExitF) (MK_EXTENSION_ARGS, MK_OBJ const fmtobj)
>
> and I want to use the *return* type of the function pointer in a macro,
> example:
>
> #define MkWalkErrExtReturn(_err, _fct, ...) ({ \
> typeof(_fct) ret = 0; \
> if (_err->mkerrext) { \
>
> MK_EXT ext, head=MkEXT(_err->mkerrext); \
>
> DL_FOREACH(head,ext) { \
>
> MK_ERREXT errext = MkErrExt(ext); \
>
> if (errext && errext->_fct) { \
>
> ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__); \
>
> if (ret) break; \
>
> } \
>
> } \
>
> } \
>
> ret; \
>
> })
>
> used in:
>
> > if (MkWalkErrExtReturn(err, fErrorResetOnExit, fmtobj)) return;
>
> the problem is that:
>
> > typeof(_fct) = typeof(fErrorResetOnExit)
>
> return the type of the entire function pointer and *not* the type of the
> function pointer return.
>
> question: it is possible to get in C (gcc) the return typ of a function
> pointer with some "typeof" extension?
>
>
> mfg

You need to create a expression calling the function. (Maybe dummy arguments)

#include <stdio.h>
double f(int a) { return 1; }

int main()
{ printf("%d\n", (int)sizeof(typeof(f)));
printf("%d\n", (int)sizeof(typeof(f(0))));
} this program prints using gcc:
1 8

I was not expecting 1 for in the first line.. but sizeof function pointer.
I was expecting 8 for the second line.

Re: typeof and function pointer

<9274cb31-8e6d-4e09-ab99-2b4c9984bd96n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21829&group=comp.lang.c#21829

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:9ad4:0:b0:6a6:a7d3:56a2 with SMTP id c203-20020a379ad4000000b006a6a7d356a2mr3524895qke.274.1654350303939;
Sat, 04 Jun 2022 06:45:03 -0700 (PDT)
X-Received: by 2002:a05:622a:1346:b0:304:d512:afe5 with SMTP id
w6-20020a05622a134600b00304d512afe5mr9941156qtk.622.1654350303754; Sat, 04
Jun 2022 06:45:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sat, 4 Jun 2022 06:45:03 -0700 (PDT)
In-Reply-To: <d8844912-5312-4292-b4d9-4a0cc124212fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2804:14d:4c84:9eab:cc02:8c1e:1eb5:fb84;
posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 2804:14d:4c84:9eab:cc02:8c1e:1eb5:fb84
References: <t7f5se$guh$1@dont-email.me> <d8844912-5312-4292-b4d9-4a0cc124212fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9274cb31-8e6d-4e09-ab99-2b4c9984bd96n@googlegroups.com>
Subject: Re: typeof and function pointer
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Sat, 04 Jun 2022 13:45:03 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Thiago Adams - Sat, 4 Jun 2022 13:45 UTC

On Saturday, June 4, 2022 at 10:06:57 AM UTC-3, Thiago Adams wrote:
> On Saturday, June 4, 2022 at 5:42:06 AM UTC-3, aotto1968 wrote:
> > Hi, I have an function pointer, example:
> >
> > typedef bool (*MkErrorResetOnExitF) (MK_EXTENSION_ARGS, MK_OBJ const fmtobj)
> >
> > and I want to use the *return* type of the function pointer in a macro,
> > example:
> >
> > #define MkWalkErrExtReturn(_err, _fct, ...) ({ \
> > typeof(_fct) ret = 0; \
> > if (_err->mkerrext) { \
> >
> > MK_EXT ext, head=MkEXT(_err->mkerrext); \
> >
> > DL_FOREACH(head,ext) { \
> >
> > MK_ERREXT errext = MkErrExt(ext); \
> >
> > if (errext && errext->_fct) { \
> >
> > ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__); \
> >
> > if (ret) break; \
> >
> > } \
> >
> > } \
> >
> > } \
> >
> > ret; \
> >
> > })
> >
> > used in:
> >
> > > if (MkWalkErrExtReturn(err, fErrorResetOnExit, fmtobj)) return;
> >
> > the problem is that:
> >
> > > typeof(_fct) = typeof(fErrorResetOnExit)
> >
> > return the type of the entire function pointer and *not* the type of the
> > function pointer return.
> >
> > question: it is possible to get in C (gcc) the return typ of a function
> > pointer with some "typeof" extension?
> >
> >
> > mfg
> You need to create a expression calling the function. (Maybe dummy arguments)
>
> #include <stdio.h>
> double f(int a) { return 1; }
>
> int main()
> {
> printf("%d\n", (int)sizeof(typeof(f)));
> printf("%d\n", (int)sizeof(typeof(f(0))));
> }
> this program prints using gcc:
> 1
> 8
>
> I was not expecting 1 for in the first line.. but sizeof function pointer.
> I was expecting 8 for the second line.

but function pointer it prints 8 ..so it makes sense.
printf("%d", (int)sizeof(void(*)()));
(MS compiler gives an error sizeof function)

Re: typeof and function pointer

<20220604080501.178@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21830&group=comp.lang.c#21830

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: typeof and function pointer
Date: Sat, 4 Jun 2022 15:07:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <20220604080501.178@kylheku.com>
References: <t7f5se$guh$1@dont-email.me>
<typeof-20220604132200@ram.dialup.fu-berlin.de>
Injection-Date: Sat, 4 Jun 2022 15:07:11 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7d4e241dab4651ec5719617cb83915d0";
logging-data="6633"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IBT1SYBXCeYQ8Bmc1cHSd7Upr96J0khg="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:Z6HeZCxQVOeNVV6bBS0JVdOMovs=
 by: Kaz Kylheku - Sat, 4 Jun 2022 15:07 UTC

On 2022-06-04, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> aotto1968 <aotto1968@t-online.de> writes:
>>question: it is possible to get in C (gcc) the return typ of a function
>>pointer with some "typeof" extension?
>
> #include <stdio.h>
>
> int main( void )
> { char f(); printf( "%d\n", ( int )( sizeof( typeof( f() )))); }

I'm not sure what the aim is here, but, obviously, the above
example is greatly improved by

printf("%d\n", (int) sizeof f());

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: typeof and function pointer

<87h750rukz.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21835&group=comp.lang.c#21835

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben)
Newsgroups: comp.lang.c
Subject: Re: typeof and function pointer
Date: Sat, 04 Jun 2022 22:23:56 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <87h750rukz.fsf@bsb.me.uk>
References: <t7f5se$guh$1@dont-email.me>
<typeof-20220604132200@ram.dialup.fu-berlin.de>
<20220604080501.178@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="dfba4b6118c6c0857829e5b5fc168675";
logging-data="2744"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pRfTK5DCV+i7akXT0AjDyMqNKOtb55f8="
Cancel-Lock: sha1:TudMEl73a2QsPDKl7zcS8RFMzF0=
sha1:3fnZl0NlwSRa+ur4BuRoNT2LZ3Q=
X-BSB-Auth: 1.8a0a903f73a1bc0f41c7.20220604222356BST.87h750rukz.fsf@bsb.me.uk
 by: Ben - Sat, 4 Jun 2022 21:23 UTC

Kaz Kylheku <480-992-1380@kylheku.com> writes:

> On 2022-06-04, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>> aotto1968 <aotto1968@t-online.de> writes:
>>>question: it is possible to get in C (gcc) the return typ of a function
>>>pointer with some "typeof" extension?
>>
>> #include <stdio.h>
>>
>> int main( void )
>> { char f(); printf( "%d\n", ( int )( sizeof( typeof( f() )))); }
>
> I'm not sure what the aim is here,

I think the aim was to show that typeof can be applied to a function
call expression, rather than to a bare function designator, and SR
wanted to confirm the type using the size -- 1 being very obviously the
size of a char.

Unfortunately that confirmation does not work because function types
have no "natural" size and gcc seems to just pick 1 (and why not?) so
had the OP changed the source to see what size typeof(f) is they would
probably be confused by the result also being 1.

For the OP: typeof (f) is a function type -- exactly the type of f.
It's not the type of pointer to f (for that you could use typeof (&f))
nor is it the return type of f (for that use typeof (f()), though in
your case you will have to provide dummy arguments).

Function types, like array types, can be useful, but they often confuse
beginners who have been told (erroneously) that C has no arrays and no
functions -- that both are "really" pointers. They are not!

--
Ben.

Re: typeof and function pointer

<86v8tfyzoj.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21836&group=comp.lang.c#21836

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: typeof and function pointer
Date: Sun, 05 Jun 2022 07:04:12 -0700
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <86v8tfyzoj.fsf@linuxsc.com>
References: <t7f5se$guh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="1e3de3f3b17d2a32ddf0f156c04f9d14";
logging-data="21320"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+x0PaAkHsaSwfhGogudaVNGfDFnNZoWhM="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:EoodNKbB2Lw1OqACPmEFl4cL/Gc=
sha1:Yj+bVy2dkXdKlUnRFf5uT/alJng=
 by: Tim Rentsch - Sun, 5 Jun 2022 14:04 UTC

aotto1968 <aotto1968@t-online.de> writes:

> Hi, I have an function pointer, example:
>
> typedef bool (*MkErrorResetOnExitF) (MK_EXTENSION_ARGS, MK_OBJ const fmtobj)
>
> and I want to use the *return* type of the function pointer in a
> macro, example:
>
> #define MkWalkErrExtReturn(_err, _fct, ...) ({ \
> typeof(_fct) ret = 0; \
> if (_err->mkerrext) { \
> MK_EXT ext, head=MkEXT(_err->mkerrext); \
> DL_FOREACH(head,ext) { \
> MK_ERREXT errext = MkErrExt(ext); \
> if (errext && errext->_fct) { \
> ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__); \
> if (ret) break; \
> } \
> } \
> } \
> ret; \
> })
>
> used in:
>
>> if (MkWalkErrExtReturn(err, fErrorResetOnExit, fmtobj)) return;
>
> the problem is that:
>
>> typeof(_fct) = typeof(fErrorResetOnExit)
>
> return the type of the entire function pointer and *not* the type
> of the function pointer return.
>
> question: it is possible to get in C (gcc) the return typ of a
> function pointer with some "typeof" extension?

The pattern to follow is for the 'typeof' expression to be the
same as an expression that is to be assigned to the variable in
question. Hence,

#define MkWalkErrExtReturn(_err, _fct, ...) ({ \
typeof( _fct (MK_EXTENSION_CALL, __VA_ARGS__) ) ret = 0; \
if (_err->mkerrext) { \
MK_EXT ext, head=MkEXT(_err->mkerrext); \
DL_FOREACH(head,ext) { \
MK_ERREXT errext = MkErrExt(ext); \
if (errext && errext->_fct) { \
ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__); \
if (ret) break; \
} \
} \
} \
ret; \
})

If you try this modified definition I expect you will find that
it does what you want.

Re: typeof and function pointer

<t7kcqu$b8g$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21848&group=comp.lang.c#21848

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: aotto1...@t-online.de (aotto1968)
Newsgroups: comp.lang.c
Subject: Re: typeof and function pointer
Date: Mon, 6 Jun 2022 10:11:10 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <t7kcqu$b8g$1@dont-email.me>
References: <t7f5se$guh$1@dont-email.me> <86v8tfyzoj.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 6 Jun 2022 08:11:10 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4cc844cb730a8a95aeec6dd842c70aaf";
logging-data="11536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//MIGvwpjJuKOzdCDI2eZuJB5Lxu6wCTg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:VBt0pJCCLCweb93qKTklspkve74=
In-Reply-To: <86v8tfyzoj.fsf@linuxsc.com>
Content-Language: en-US
 by: aotto1968 - Mon, 6 Jun 2022 08:11 UTC

On 05.06.22 16:04, Tim Rentsch wrote:

>
> The pattern to follow is for the 'typeof' expression to be the
> same as an expression that is to be assigned to the variable in
> question. Hence,
>
> #define MkWalkErrExtReturn(_err, _fct, ...) ({ \
> typeof( _fct (MK_EXTENSION_CALL, __VA_ARGS__) ) ret = 0; \
> if (_err->mkerrext) { \
> MK_EXT ext, head=MkEXT(_err->mkerrext); \
> DL_FOREACH(head,ext) { \
> MK_ERREXT errext = MkErrExt(ext); \
> if (errext && errext->_fct) { \
> ret = _fct (MK_EXTENSION_CALL, __VA_ARGS__); \
> if (ret) break; \
> } \
> } \
> } \
> ret; \
> })
>
> If you try this modified definition I expect you will find that
> it does what you want.

This looks good, thanks.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor