cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_off_t suffix

From: Yang Tse <yangsita_at_gmail.com>
Date: Thu, 14 Aug 2008 13:13:55 +0200

2008/8/14, Dan Fandrich wrote:

> [...] here is Open Watcom's definition for INT64_C:
>
> #define INT64_C(x) (x + (INT64_MAX - INT64_MAX))

Yes that is the definition the test is 'seeing', the source the test
is using and the preprocessed output follow:

cpp-src> INT64_C(CURL_DEF_TOKEN)
cpp-out> (CURL_DEF_TOKEN + (9223372036854775807LL - 9223372036854775807LL))

How on earth can we extract something useful from that. BTW the actual
constant is not suffixed with any suffix!!

> Boy, that's going to be fun to parse in m4! It may be easier to parse
> INT64_MAX instead and extract the suffix; Watcom defines that as a simple
>
> #define INT64_MAX 9223372036854775807LL
>
> but, surely, that's in itself no more portable.

Lets see...

Which actual signed suffixes exist out there ? 'L' 'LL' 'i128' 'i64'
'i32' 'i16' 'i8'

Something else ?

> By the way, immediately before INT64_C in the Watcom header files is this:
>
> /* Constant macros. According to C99 these are only visible in C++ programs
> if __STDC_CONSTANT_MACROS is defined. */
> #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
>
> so you may want to investigate whether setting __STDC_CONSTANT_MACROS would
> ever be necessary.

Hmm. I wouldn't be too much worried with this, after all the compiler
will understand them if they are used.

What is now bugging me is what happens with true pre C99 compilers if
the suffix is used. I'll grab TurboC 2.x and see what happens.

-- 
-=[Yang]=-
Received on 2008-08-14