cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ## macro question

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 29 Jul 2002 15:38:47 +0200 (MET DST)

On Fri, 26 Jul 2002 Priya.Ramakrishnan_at_WellsFargo.COM wrote:

(Moving this discussion over to the libcurl mailing list.)

> We have come across a peculiar compilation problem with curl.h. We
> are compiling on HP and SUN. We noticed that CINIT and CFINIT have been
> altered to something different. Our compilers understand the ## macro, but
> now that macro is no longer available.

I should've guessed that we would end up with a problem like this! ;-)

> I understand that ## macro is ISO C.

Yeah, and ANSI too. (For a great reference, check out Bjorn Reese's
http://predef.sourceforge.net/)

> But the ifdef statement used to separate the different definitions of CINIT
> and CFINIT break our builds. We were using 7.9.5 with the single definition
> of CINIT and CFINIT. 7.9.5 worked great.

Worked great for most of us, since most of us use good and healthy ANSI/ISO
compilers. Then someone threw the header on a less friendly compiler and then
we needed to add that preprocessor check.

Now we need to extend the check to make more compilers happy.

> #ifdef CINIT
> #undef CINIT
> #endif
> #if defined(__STDC__) || defined(_MSC_VER)
> #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type +
> number
> #else
>
> ^^^ This only works on WINDOWS because of _MSC_VER, but not on HP or SUN..

I fail to understand *why* the HP and SUN compilers don't have __STDC__
defined though. Do they have _XOPEN_SOURCE defined? Or do you have any other
interesting suggestions? ;-)

> What if we tried this? It is just a suggestion. We are using aCC A.03.34
> (HP) and gcc 3.0.4 (SUN) and cl.exe 12.00.8168 (windows/VC++ 6.0)
>
> #if defined(ISO_C)

Well, *no* compiler has that defined! Besides, you made the check reversed,
as ISO compilers are likely to (or rather should) have and support ##.

-- 
 Daniel Stenberg -- curl related mails on curl related mailing lists please
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
Received on 2002-07-29