cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [off-topic] @|!?#=%""/ C preprocessor or @|!?#=%""/ me

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Mon, 11 Aug 2008 15:21:01 -0400

On Mon, Aug 11, 2008 at 2:55 PM, Yang Tse <yangsita_at_gmail.com> wrote:
> Hi,
>
> The above @|!?=%""/ can be replaced with whatever you want ;-)
>
> I seem to be running out of gas on this one. So if someone knows how
> to do this or if it certainly is impossible to achieve I would
> appreciate any comments.
>
> #define CURL_SUFFIX_CURL_OFF_T LL
>
> #define CURL_OFF_T_C(V) V ## CURL_SUFFIX_CURL_OFF_T
>
> Given the above, which certainly does not give the result that I want,
> lets say that I would like to use something like:
>
> CURL_OFF_T_C(0x500)
>
> And that it expanded to: 0x500LL
>
> Is it possible or should I just forget this ?

Perhaps this?

#define CURL_SUFFIX_CURL_OFF_T LL
#define CURL_OFF_T_C_HELPER2(V, SUF) V##SUF
#define CURL_OFF_T_C_HELPER1(V, SUF) CURL_OFF_T_C_HELPER2(V, SUF)
#define CURL_OFF_T_C(V) CURL_OFF_T_C_HELPER1(V, CURL_SUFFIX_CURL_OFF_T)

Lars Nilsson
Received on 2008-08-11