Op 28-07-10 15:41, Rainer Jung schreef: > On 28.07.2010 13:44, Dan Poirier wrote: >> On 2010-07-28 at 03:51, Alex Wulms<[email protected]> wrote: >> >>> Hi, >>> >>> While adding some debug log statements to a module I'm working on, I >>> ran >>> into the problem that ap_log_error (in apache 2.2) does not support %zd >>> or %zu conversion for type_t arguments. This was problematic to make >>> the >>> code compile on both 32 and 64 bit platforms. >> >>> * platform (32-bit or 64-bit). This violates the whole purpose of >>> type_t, which >>> * was introduced in C exactly to provide cross-platform >>> compatibility... >> >> I'm confused. Neither c89 nor c99 define a type "type_t", as far as I >> can see. >> >> But you might find the *_FMT macro definitions from APR helpful, or else >> explain your problem in more detail? > > It seems in C99 a length specifier "z" means: For integer types, > causes printf to expect a size_t sized integer argument. Citing: > > Specifies that a following d, i, o, u, x, or X conversion specifier > applies to a size_t or the corresponding signed integer type argument; > or that a following n conversion specifier applies to a pointer to a > signed integer type corresponding to size_t argument. > > At least cross checking on Solaris 10 shows it is actually implemented > for printf() there. > > So: type_t -> size_t and the OP should be able to use APR_SIZE_T_FMT > or APR_SSIZE_T_FMT (signed) as you suggested. > Thanks for the tip about the APR formatting macro's (I'm still getting up to speed on the features of the APR API). It is indeed what I need. I'll adapt the code accordingly.
Cheers, Alex
