libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libltdl & 64-bit lint


From: Tim Mooney
Subject: Re: libltdl & 64-bit lint
Date: Sun, 30 Sep 2001 23:19:35 -0500 (CDT)

In regard to: Re: libltdl & 64-bit lint, address@hidden said...:

>static lt_ptr
>realloc (ptr, size)
>     lt_ptr ptr;
>     size_t size;
>{
>  if (size <= 0)
>
>Is size_t always unsigned?

It is on all the platforms I've seen -- that's why there's an ssize_t
(signed size_t).

>  sprintf (filename, "%.*s/%s", (int) dirname_len, dirname, dlname);
>
>According to sprintf(3) on a Linux box, when using %*, the field width
>must be of type int.

The other man pages I've seen agree.

>> (3235) warning: argument #4 is incompatible with prototype:
>>      prototype: pointer to void : "ltdl.c", line 2159
>>      argument : pointer to function(pointer to const char, pointer to void) 
>> returning int
>> (3241) warning: argument #4 is incompatible with prototype:
>>      prototype: pointer to void : "ltdl.c", line 2159
>>      argument : pointer to function(pointer to const char, pointer to void) 
>> returning int
>> (3245) warning: argument #4 is incompatible with prototype:
>>      prototype: pointer to void : "ltdl.c", line 2159
>>      argument : pointer to function(pointer to const char, pointer to void) 
>> returning int
>> (3252) warning: argument #4 is incompatible with prototype:
>>      prototype: pointer to void : "ltdl.c", line 2159
>>      argument : pointer to function(pointer to const char, pointer to void) 
>> returning int
>> (3259) warning: argument #4 is incompatible with prototype:
>>      prototype: pointer to void : "ltdl.c", line 2159
>>      argument : pointer to function(pointer to const char, pointer to void) 
>> returning int
>
>We've already discussed this. No clear solution.

There is one, though I never brought it up before because all current
compilers I've seen accept the code (so it didn't seem to be worth
worrying about).

The portable solution would be to not "overload" what the pointer points
to.  Instead, define a struct or a union that has members of the
appropriate type (pointer to an function with the right type, or a pointer
to the right struct type, or whatever else the function needs to be able
to return), and then return a pointer to that struct (or union).  That
way you're always returning a pointer to a struct or union of a particular
type, it's just that different functions make use of different members of
the struct or union.

Tim
-- 
Tim Mooney                              address@hidden
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164




reply via email to

[Prev in Thread] Current Thread [Next in Thread]