On 20/06/11 22:24, MacArthur, Ian (SELEX GALILEO, UK) wrote:
> I just noticed I mis-spelled the lib name in the title; fltk or flth
> anyone?
>
>
>>> The "first" option that the compiler offers is the one expanding
>>> "alert(va_list, const char *);" where the va_list is
>> expanded here as a
>>> "char*", so it's (possibly) not really in our remit to be
>> able to set
>>> how the va_list is interpreted?
>> Oh, I was under the impression there explicitly exist 2 alert()
>> functions - this is what I get for not reading the source!
> There are two, being:
>
> A)  FLTK3_EXPORT void alert(const char *,...) __fl_attr((__format__
> (__printf__, 1, 2)));
> B)  FLTK3_EXPORT void alert(va_list, const char *);
>
> And thereby lies the issue; they are more or less the same thing, but
> (A) expands as
>
>       (const char *, ...)     
>
> And (B) becomes:
>
>       (char *, const char *)  
>
> So both are equally bad or good for what the compiler is looking for
> (const char *, const char *) at this point in our code... From the
> message we see that gcc "prefers" (B), but...
>
> Actually, making (A) be (char *,...) might work to get things working in
> our favour too, perhaps?
>
> Hmm, yup, that seems to compile without issues, too.
>
Ah, this achieves the same as the (char*) cast, and is a far better 
idea! We can always use a const_cast<...> inside the alert() function to 
achieve the same const-ness if required

Ben

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to